From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25016 invoked by alias); 10 Nov 2012 23:54:18 -0000 Received: (qmail 24953 invoked by uid 48); 10 Nov 2012 23:53:58 -0000 From: "glibc at iamsergio dot de" To: glibc-bugs@sources.redhat.com Subject: [Bug malloc/14827] New: free() doesn't honor M_TRIM_THRESHOLD Date: Sat, 10 Nov 2012 23:54:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: malloc X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: glibc at iamsergio dot de X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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: 2012-11/txt/msg00092.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=14827 Bug #: 14827 Summary: free() doesn't honor M_TRIM_THRESHOLD Product: glibc Version: 2.16 Status: NEW Severity: normal Priority: P2 Component: malloc AssignedTo: unassigned@sourceware.org ReportedBy: glibc@iamsergio.de Classification: Unclassified Created attachment 6725 --> http://sourceware.org/bugzilla/attachment.cgi?id=6725 test-case free() isn't calling brk() to give memory back to the kernel when M_TRIM_THRESHOLD is passed. Run the attached test-case. What it does: 1. Calls malloc() 2800000 times 2. Calls free() 2800000 times 3. pauses, so you can inspect the heap size. You'll see that the heap size is around 250 MB. Manually calling malloc_trim(), through gdb, decreases the heap size to 4 K. ---------------------------------------------------- How I measured heap size: $ cat /proc/12345/maps | grep heap 01bc6000-0f180000 rw-p 00000000 00:00 0 [heap] $ python > (0x0f180000-0x01bc6000) / (1024*1024) > 213 213 Megabytes $ top -p12345 # tested with top too 227m 214m for VIRT and RES respectively $ gdb -pid 12345 # Lets attach gdb and call malloc_trim() > call malloc_trim(0) $ top -p12345 14492 1076 for VIRT and RES respectively $ cat /proc/12345/maps | grep heap 01bc6000-01bc7000 rw-p 00000000 00:00 0 [heap] $ python > (0x01bc7000-0x01bc6000) / (1024*1024) > 0.00390625 // 4KB ------------------------------------------------------------ I'm on Linux 3.6.5 with glibc-2.16 -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.