This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug malloc/15321] New: malloc/free can't give the memory back to kernel when main_arena is discontinous
- From: "xu.zhanxin at zte dot com.cn" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Fri, 29 Mar 2013 09:30:36 +0000
- Subject: [Bug malloc/15321] New: malloc/free can't give the memory back to kernel when main_arena is discontinous
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=15321
Bug #: 15321
Summary: malloc/free can't give the memory back to kernel when
main_arena is discontinous
Product: glibc
Version: 2.17
Status: NEW
Severity: normal
Priority: P2
Component: malloc
AssignedTo: unassigned@sourceware.org
ReportedBy: xu.zhanxin@zte.com.cn
CC: xu.zhanxin@zte.com.cn
Classification: Unclassified
Created attachment 6957
--> http://sourceware.org/bugzilla/attachment.cgi?id=6957
testcase for free can't give the memory back to kernel
Compile and run the attached test-case.
What it does:
1.Call malloc() to allocate 1024*4kB memory
2.Call mmap()
3.Call malloc() and allocate 4096kB memory again
4.Call system to inspect the MemFree
5.Call free()
6.Call system to inspect the MemFree again
So,The will be free 8192kB memory,but it not.
-------------------------------------------------------------
[xuzhanxin@localhost t-arena]$ gcc -o test-ok testcase.c -g -DUNMAP_OK
[xuzhanxin@localhost t-arena]$ gcc -o test-err testcase.c -g
[xuzhanxin@localhost t-arena]$ ./test-ok
First malloc ok
mmap ok
Second malloc ok!
MemFree: 12630976 kB
After free memory!
MemFree: 12638540 kB
[xuzhanxin@localhost t-arena]$ ./test-err
First malloc ok
mmap ok
Second malloc ok!
MemFree: 12627628 kB
After free memory!
MemFree: 12627380 kB
--
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.