Memory Fragmentation

Benjamin Bazso bbazso at
Thu Mar 21 07:21:29 PDT 2013


I am using jemalloc for my server application and I have been monitoring
the memory (rss) for several days and it continues to rise.  I have
previously monitored the application using valgrind for several days and it
reported no memory leaks.

This leads me to believe that the rise in memory consumption (rss) is due
to memory fragmentation.

With this in mind, I added to my application the call to malloc_stats_print(
**) function and I poll this function every hour and save the results.
>From what I see and understand from this report, I do indeed see the memory
consumption rising and I also noticed that the number of bigger allocations
increases (~2.5 MB) over time.

I have been reading quite a bit about jemalloc, and what I fail to
understand how to do yet is how to use this report to support the notion
that my application is actually experiencing memory fragmentation.

So my questions are:

   1. How can I use the malloc_stats_print(**) stats to show that my
   application is suffering from memory fragmentation?
   2. Is there a way to help eliminate fragmentation in jemalloc, perhaps
   by calling an extended facility?
   3. Will using thread cache flushing and forced dirty page purging help
   reduce fragmentation? Is it a good idea?

Thanks a lot for the help and have a great day,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the jemalloc-discuss mailing list