From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4431 invoked by alias); 10 Feb 2010 14:29:17 -0000 Received: (qmail 4385 invoked by uid 48); 10 Feb 2010 14:29:06 -0000 Date: Wed, 10 Feb 2010 14:29:00 -0000 Message-ID: <20100210142906.4384.qmail@sourceware.org> From: "rich at testardi dot com" To: glibc-bugs@sources.redhat.com In-Reply-To: <20100208202339.11261.rich@testardi.com> References: <20100208202339.11261.rich@testardi.com> Reply-To: sourceware-bugzilla@sourceware.org Subject: [Bug libc/11261] malloc uses excessive memory for multi-threaded applications X-Bugzilla-Reason: CC Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2010-02/txt/msg00058.txt.bz2 ------- Additional Comments From rich at testardi dot com 2010-02-10 14:29 ------- And a comment for anyone else who might stumble this way... I *can* reduce the total number of arenas to *2* (not low enough for our purposes) with the following sequence: export MALLOC_PER_THREAD=1 rv = mallopt(-7, 1); // M_ARENA_TEST printf("%d\n", rv); rv = mallopt(-8, 1); // M_ARENA_MAX printf("%d\n", rv); *PLUS* I have to have a global pthread mutex around every malloc(3) and free (3) call -- I can't figure out from the code why this is required, but without it the number of arenas seems independent of the mallopt settings. I cannot get to *1* arena because a) mallopt() won't allow you to set arena_test to 0: #ifdef PER_THREAD case M_ARENA_TEST: if (value > 0) mp_.arena_test = value; break; case M_ARENA_MAX: if (value > 0) mp_.arena_max = value; break; #endif And b) reused_arena() uses a ">=" here rather than a ">": static mstate reused_arena (void) { if (narenas <= mp_.arena_test) return NULL; -- http://sourceware.org/bugzilla/show_bug.cgi?id=11261 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.