how to get the memory usage of the process in RAM with jemalloc

405 views Asked by At

I am working on a memory tracker based on jemalloc. It is used to collect basic memory stats roughly of the process by calling mallctl and prevent more upcoming requests when memory is over a threshold.

Previously I use the stats.mapped or stats.resident, but later I found out that even if some allocated memory is released, these memory were not returned to the OS even after purge or decay. All memory will be munmap when process exit. Using stats.allocated or stats.active can't get the correct result since shared memory and other usages are excluded.

My question is, how to get the memory usage of the process in RAM with jemalloc? Something like RSS in top or ps reported by OS.

Thanks!

0

There are 0 answers