From owner-freebsd-stable@FreeBSD.ORG Thu Oct 5 16:46:04 2006 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 44EAB16A492 for ; Thu, 5 Oct 2006 16:46:04 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id D271E43D82 for ; Thu, 5 Oct 2006 16:46:03 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.13.6/8.13.8) id k95GjwSV002504; Thu, 5 Oct 2006 11:45:58 -0500 (CDT) (envelope-from dan) Date: Thu, 5 Oct 2006 11:45:58 -0500 From: Dan Nelson To: Vlad GALU Message-ID: <20061005164558.GA65461@dan.emsphone.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-OS: FreeBSD 6.2-PRERELEASE X-message-flag: Outlook Error User-Agent: Mutt/1.5.13 (2006-08-11) Cc: freebsd-stable@freebsd.org Subject: Re: Is jemalloc going to make its way into RELENG_6? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Oct 2006 16:46:04 -0000 In the last episode (Oct 05), Vlad GALU said: > Judging from my tests (allocating numerous small objects, then > freeing the memory) it looks like the bottleneck is in free(). I've > built a different libc library with the malloc.c and tree.h taken > from HEAD and it now behaves nicely. I haven't seen any bad side > effects on this machine (it's the lappie I do most of my work on, I > run KDE, seamonkey, mplayer, openoffice, the like) since I switched > to the new libc. Another nice solution would be to ship the modified > libc in base so the people who really need jemalloc can relink to it > via libmap.conf. You can compile just the -current version of malloc.c as a shared object, then inject it into specific binaries: $ gcc -O -Wall -I/usr/src/lib/libc/include -shared -o /lib/jemalloc.so jemalloc.c $ MALLOC_OPTIONS=P date date in malloc(): warning: unknown char in MALLOC_OPTIONS Thu Oct 5 11:44:36 CDT 2006 $ LD_PRELOAD=/lib/jemalloc.so MALLOC_OPTIONS=P date |& head Thu Oct 5 11:44:49 CDT 2006 ___ Begin malloc statistics ___ Number of CPUs: 2 Number of arenas: 11 Chunk size: 524288 (2^19) Quantum size: 16 (2^4) Max small size: 512 Pointer size: 4 Assertions enabled Allocated: 4096, space used: 1048576 I've tried this with seamonkey and mysqld, so this method seems to work fine on complex apps. -- Dan Nelson dnelson@allantgroup.com