public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "glibc at iamsergio dot de" <sourceware-bugzilla@sourceware.org> 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 [thread overview] Message-ID: <bug-14827-131@http.sourceware.org/bugzilla/> (raw) 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.
next reply other threads:[~2012-11-10 23:54 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-11-10 23:54 glibc at iamsergio dot de [this message] 2012-11-16 17:03 ` [Bug malloc/14827] " glibc at iamsergio dot de 2012-11-18 0:06 ` mail at milianw dot de 2012-11-19 17:04 ` mail at milianw dot de 2013-05-28 8:05 ` bharath.vegito at gmail dot com 2014-06-14 11:11 ` fweimer at redhat dot com 2020-04-28 17:03 ` carlos at redhat dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-14827-131@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sources.redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).