From owner-freebsd-ports@freebsd.org Sat Nov 4 15:56:03 2017 Return-Path: Delivered-To: freebsd-ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E20A7E4E7A2 for ; Sat, 4 Nov 2017 15:56:03 +0000 (UTC) (envelope-from pete@nomadlogic.org) Received: from vps-mail.nomadlogic.org (mail.nomadlogic.org [IPv6:2607:f2f8:a098::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA98E7379A for ; Sat, 4 Nov 2017 15:56:03 +0000 (UTC) (envelope-from pete@nomadlogic.org) Received: from [192.168.1.208] (cpe-23-242-94-236.socal.res.rr.com [23.242.94.236]) by vps-mail.nomadlogic.org (OpenSMTPD) with ESMTPSA id 9dde5e35 TLS version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO for ; Sat, 4 Nov 2017 08:55:59 -0700 (PDT) Subject: Re: FireFox memory usage To: freebsd-ports@freebsd.org References: <20171104124932.08551078@kalimero.tijl.coosemans.org> From: Pete Wright Message-ID: <503ed6c2-34da-4342-cd72-87ee8e85f8bb@nomadlogic.org> Date: Sat, 4 Nov 2017 08:56:01 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171104124932.08551078@kalimero.tijl.coosemans.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Nov 2017 15:56:04 -0000 On 11/04/2017 04:49, Tijl Coosemans wrote: > On Wed, 01 Nov 2017 21:10:13 +0100 Jan Beich wrote: >> Jan Beich writes: >>> Andrea Venturoli writes: >>>> I'm on 10.3/amd64 with firefox-esr 52.3.0. >>>> >>>> Since a few days my 4GiB desktop is crawling due to swap usage and >>>> looking at top, I see FireFox using almost 7GiB of RAM (SIZE column), >>>> 2.5 of which are "RES". >>> Check about:memory and Devolper Tools -> Memory for clues. For more >>> advanced debugging (DMD, Refcount tracing) you'd need a custom build. >>> >>> Firefox on FreeBSD is known to consume more memory than on other >>> platforms because it uses system jemalloc rather than mozjemalloc. >>> Mozilla doesn't test memory usage without mozjemalloc. However, porting >>> mozjemalloc has stalled[1] unless someone helps. >>> >>> [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1153683 >> If one is on Firefox 55+ or FreeBSD 12+ while suboptimal compared to >> mozjemalloc the old jemalloc4 optimizations can be restored by >> >> $ MALLOC_CONF="narenas:1,tcache:false" firefox ... >> >> https://dxr.mozilla.org/mozilla-esr52/source/memory/build/jemalloc_config.cpp#35 > This appears to be such a huge improvement that you should really put > this in the port even if it's still not as good as mozjemalloc. i can confirm a huge perf improvement by reverting to jemalloc4. would this patch ensure we use this by default until mozjemalloc for FreeBSD is sorted out? diff --git a/www/firefox/Makefile b/www/firefox/Makefile index 7da37422ad82..b9a349e5d217 100644 --- a/www/firefox/Makefile +++ b/www/firefox/Makefile @@ -46,7 +46,8 @@ FIREFOX_ICON_SRC= ${PREFIX}/lib/${MOZILLA}/browser/chrome/icons/default/default4  MOZ_EXPORT=    BINDGEN_CFLAGS="-isystem${LOCALBASE}/include/nspr \                         -isystem${LOCALBASE}/include/pixman-1" # XXX bug 1341234  MOZ_OPTIONS=   --enable-application=browser \ -               --enable-official-branding +               --enable-official-branding \ +        --enable-jemalloc=4  OPTIONS_DEFAULT=       BUNDLED_CAIRO  OPTIONS_EXCLUDE=       GNOMEUI i'm not super familiar with how we build firefox but if this looks good i can file a PR. -pete -- Pete Wright pete@nomadlogic.org @nomadlogicLA