glibc's malloc: arenas and memory fragmentation?
From: Ozgun (ozgune_at_gmail.com)
Date: 12/28/04
- Previous message: Gary Kato: "Re: Direct Linux syscalls"
- Next in thread: Last2Know: "Re: glibc's malloc: arenas and memory fragmentation?"
- Reply: Last2Know: "Re: glibc's malloc: arenas and memory fragmentation?"
- Reply: John Reiser: "Re: glibc's malloc: arenas and memory fragmentation?"
- Reply: Jonathan Bartlett: "Re: glibc's malloc: arenas and memory fragmentation?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 27 Dec 2004 22:37:55 -0800
Hi all -
We have an application that spawns off four threads at start-up. Our
memory allocation pattern is basically in spikes: the application is
idle for a while, and then allocates and frees tens (if not hundreds)
of MBs in a couple of seconds.
We set a hard limit on the Data size of the application, and if the
app. exceeds a certain limit, we process-recycle it. Under glibc 2.2,
here's what malloc_stats() prints for our application:
Arena 0:
system bytes = 102883720
in use bytes = 91413448
Arena 1:
system bytes = 23896064
in use bytes = 2566048
Arena 2:
system bytes = 57393152
in use bytes = 5984928
Total (incl. mmap):
system bytes = 184959368
in use bytes = 100750856
max mmap regions = 4
max mmap bytes = 2912256
If we don't set a hard limit for the Data size and continue to run the
program, the Data and Resident Set sizes continue to increase
(somewhat) linearly with the former increasing 3x-4x faster than the
later. Under memory debugging tools, our heap allocation appears as 120
MBs, and stays flat over time.
We run this application on a box that has 2 GB of RAM. An strace for
the application shows lots (and lots) of mmap2s() with a few sbrks().
[sbrk() calls don't hit the 900 MB limit.]
Is there any way to ask glibc's malloc() to coalesce the memory it has
allocated (or anything else that would eat less CPU cycles than process
recycling)? What are some other ways of minimizing the memory
fragmentation (or could this be anything other than mem.
fragmentation)?
Thanks,
Ozgun.
- Previous message: Gary Kato: "Re: Direct Linux syscalls"
- Next in thread: Last2Know: "Re: glibc's malloc: arenas and memory fragmentation?"
- Reply: Last2Know: "Re: glibc's malloc: arenas and memory fragmentation?"
- Reply: John Reiser: "Re: glibc's malloc: arenas and memory fragmentation?"
- Reply: Jonathan Bartlett: "Re: glibc's malloc: arenas and memory fragmentation?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|