keeping memory usage at certain limit

Antony Dovgal antony.dovgal at gmail.com
Mon Apr 28 04:08:16 PDT 2014


Hello all,

I'm currently working on a daemon that processes a lot of data and has to store the most recent of it.
Unfortunately, memory is allocated and freed in small blocks and in totally random (for the allocator) manner.
I use "stats.allocated" to measure how much memory is currently in use, delete the oldest data when the memory limit is reached and purge thread caches with "arena.N.purge" from time to time.

The problem is that keeping stat.allocated on a certain level doesn't keep the process from growing until it's killed by OOM-killer.
I suspect that this is caused by memory fragmentation issues, though I've no idea how to prove it (or at least all my ideas involve complex stats and are quite inefficient).

So my main questions are:
is there any way to see how much memory is currently being (under)used because of fragmentation in Jemalloc?
is there a way to prevent it or force some garbage collection?

Thanks in advance.

-- 
Wbr,
Antony Dovgal


More information about the jemalloc-discuss mailing list