From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26363 invoked by alias); 26 Apr 2006 02:15:25 -0000 Received: (qmail 26355 invoked by uid 48); 26 Apr 2006 02:15:22 -0000 Date: Wed, 26 Apr 2006 02:15:00 -0000 Message-ID: <20060426021522.26354.qmail@sourceware.org> From: "drepper at redhat dot com" To: glibc-bugs@sources.redhat.com In-Reply-To: <20060409085351.2531.sakovacs@freemail.hu> References: <20060409085351.2531.sakovacs@freemail.hu> Reply-To: sourceware-bugzilla@sourceware.org Subject: [Bug libc/2531] missing call or documentation for malloc_trim() ... X-Bugzilla-Reason: CC Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2006-04/txt/msg00333.txt.bz2 List-Id: ------- Additional Comments From drepper at redhat dot com 2006-04-26 02:15 ------- Why don't you make your little program write out the data: #include #include #include #include int main (int argc, char *argv[]) { char cmd[100]; snprintf (cmd, sizeof (cmd), "grep heap /proc/%d/maps || echo no heap", getpid ()); void *before = sbrk (0); system (cmd); int max = 10000000; char **p1 = (char **) malloc (max * sizeof (char *)); for (int x = 0; x < max; x++) { p1[x] = (char *) malloc (29); } for (int x = 0; x < max; x++) { free (p1[x]); } free (p1); void *middle = sbrk (0); system (cmd); malloc_trim (0); void *after = sbrk (0); system (cmd); printf ("before = %p, middle = %p, after = %p\n", before, middle, after); return 0; } When I run this I see no heap 00501000-1cee1000 rw-p 00501000 00:00 0 [heap] 00501000-00502000 rw-p 00501000 00:00 0 [heap] before = 0x501000, middle = 0x1cee1000, after = 0x502000 This clearly shows that a) libc returns all memory if malloc_trim is used b) the kernel frees all memory. So, what's the problem? -- What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID http://sourceware.org/bugzilla/show_bug.cgi?id=2531 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.