public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug malloc/15321] New: malloc/free can't give the memory back to kernel when main_arena is discontinous
@ 2013-03-29  9:30 xu.zhanxin at zte dot com.cn
  2013-03-29 17:24 ` [Bug malloc/15321] " ondra at iuuk dot mff.cuni.cz
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: xu.zhanxin at zte dot com.cn @ 2013-03-29  9:30 UTC (permalink / raw)
  To: glibc-bugs

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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug malloc/15321] malloc/free can't give the memory back to kernel when main_arena is discontinous
  2013-03-29  9:30 [Bug malloc/15321] New: malloc/free can't give the memory back to kernel when main_arena is discontinous xu.zhanxin at zte dot com.cn
@ 2013-03-29 17:24 ` ondra at iuuk dot mff.cuni.cz
  2013-04-02  9:53 ` xu.zhanxin at zte dot com.cn
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ondra at iuuk dot mff.cuni.cz @ 2013-03-29 17:24 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=15321

OndrejBilka <ondra at iuuk dot mff.cuni.cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #6957|0                           |1
        is obsolete|                            |

--- Comment #1 from OndrejBilka <ondra at iuuk dot mff.cuni.cz> 2013-03-29 17:24:49 UTC ---
Created attachment 6958
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6958
new testcase

Could you make it to leak memory repeately?

I enclosed your test in loop and memory consumption remains stable.

-- 
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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug malloc/15321] malloc/free can't give the memory back to kernel when main_arena is discontinous
  2013-03-29  9:30 [Bug malloc/15321] New: malloc/free can't give the memory back to kernel when main_arena is discontinous xu.zhanxin at zte dot com.cn
  2013-03-29 17:24 ` [Bug malloc/15321] " ondra at iuuk dot mff.cuni.cz
@ 2013-04-02  9:53 ` xu.zhanxin at zte dot com.cn
  2013-04-02 11:06 ` fweimer at redhat dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: xu.zhanxin at zte dot com.cn @ 2013-04-02  9:53 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=15321

--- Comment #2 from Zhanxin.xu <xu.zhanxin at zte dot com.cn> 2013-04-02 09:53:29 UTC ---
(In reply to comment #1)
> Created attachment 6958 [details]
> new testcase
> Could you make it to leak memory repeately?
> I enclosed your test in loop and memory consumption remains stable.

The memory(8k) can be used by itself,so memory exhausted not occur in loop.

[@localhost t-arena]$ cat /proc/22652/smaps |grep Rss
Rss:                 88 kB
Rss:                  4 kB
Rss:                  4 kB
Rss:                192 kB
Rss:                  0 kB
Rss:                  8 kB
Rss:                  4 kB
Rss:                 12 kB
Rss:                  4 kB
Rss:                  4 kB
Rss:                  4 kB
Rss:               5028 kB   /* can't free */
Rss:                  0 kB
Rss:               3208 kB   /* can't free */
Rss:                  4 kB
Rss:                  8 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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug malloc/15321] malloc/free can't give the memory back to kernel when main_arena is discontinous
  2013-03-29  9:30 [Bug malloc/15321] New: malloc/free can't give the memory back to kernel when main_arena is discontinous xu.zhanxin at zte dot com.cn
  2013-03-29 17:24 ` [Bug malloc/15321] " ondra at iuuk dot mff.cuni.cz
  2013-04-02  9:53 ` xu.zhanxin at zte dot com.cn
@ 2013-04-02 11:06 ` fweimer at redhat dot com
  2013-04-16 14:39 ` siddhesh at redhat dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: fweimer at redhat dot com @ 2013-04-02 11:06 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=15321

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com

--- Comment #3 from Florian Weimer <fweimer at redhat dot com> 2013-04-02 11:06:32 UTC ---
(In reply to comment #0)
> 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

I'm not sure this test case is valid.  Without compaction (which tends to break
C semantics), you can always find a sequence of allocations that result in
fragmentation.  As Ondrej said, as long as the test reaches a steady state when
executed in a loop, this is not a bug.

-- 
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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug malloc/15321] malloc/free can't give the memory back to kernel when main_arena is discontinous
  2013-03-29  9:30 [Bug malloc/15321] New: malloc/free can't give the memory back to kernel when main_arena is discontinous xu.zhanxin at zte dot com.cn
                   ` (2 preceding siblings ...)
  2013-04-02 11:06 ` fweimer at redhat dot com
@ 2013-04-16 14:39 ` siddhesh at redhat dot com
  2014-06-13 18:34 ` fweimer at redhat dot com
  2023-10-06 17:21 ` guillaume at morinfr dot org
  5 siblings, 0 replies; 7+ messages in thread
From: siddhesh at redhat dot com @ 2013-04-16 14:39 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=15321

Siddhesh Poyarekar <siddhesh at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |siddhesh at redhat dot com
         Resolution|                            |INVALID

--- Comment #4 from Siddhesh Poyarekar <siddhesh at redhat dot com> 2013-04-16 14:39:19 UTC ---
Closing as NOTABUG based on comment 3.  malloc/free indeed cannot give address
space back to the kernel when main arena is discontinuous and that is expected
behaviour.

-- 
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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug malloc/15321] malloc/free can't give the memory back to kernel when main_arena is discontinous
  2013-03-29  9:30 [Bug malloc/15321] New: malloc/free can't give the memory back to kernel when main_arena is discontinous xu.zhanxin at zte dot com.cn
                   ` (3 preceding siblings ...)
  2013-04-16 14:39 ` siddhesh at redhat dot com
@ 2014-06-13 18:34 ` fweimer at redhat dot com
  2023-10-06 17:21 ` guillaume at morinfr dot org
  5 siblings, 0 replies; 7+ messages in thread
From: fweimer at redhat dot com @ 2014-06-13 18:34 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=15321

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug malloc/15321] malloc/free can't give the memory back to kernel when main_arena is discontinous
  2013-03-29  9:30 [Bug malloc/15321] New: malloc/free can't give the memory back to kernel when main_arena is discontinous xu.zhanxin at zte dot com.cn
                   ` (4 preceding siblings ...)
  2014-06-13 18:34 ` fweimer at redhat dot com
@ 2023-10-06 17:21 ` guillaume at morinfr dot org
  5 siblings, 0 replies; 7+ messages in thread
From: guillaume at morinfr dot org @ 2023-10-06 17:21 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=15321

Guillaume Morin <guillaume at morinfr dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |guillaume at morinfr dot org

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-10-06 17:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-29  9:30 [Bug malloc/15321] New: malloc/free can't give the memory back to kernel when main_arena is discontinous xu.zhanxin at zte dot com.cn
2013-03-29 17:24 ` [Bug malloc/15321] " ondra at iuuk dot mff.cuni.cz
2013-04-02  9:53 ` xu.zhanxin at zte dot com.cn
2013-04-02 11:06 ` fweimer at redhat dot com
2013-04-16 14:39 ` siddhesh at redhat dot com
2014-06-13 18:34 ` fweimer at redhat dot com
2023-10-06 17:21 ` guillaume at morinfr dot org

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).