On Nov 26, 2013, at 11:40 AM, Eduardo Silva <[email protected]> wrote:
> i am interested into gather memory usage per Linux thread, as i am using 
> jemalloc i think this can be done quering the arenas per thread. if i am 
> correct, do you have some code example that accomplish something similar to 
> this ?

Threads don't own memory; allocated regions can be shared among threads, and 
allocation/deallocation can be split between threads.  That said, jemalloc does 
track total volume of allocation and deallocation on a per thread basis, so you 
can derive the information you want as long as you account for allocated 
regions that are shared among threads.  Take a look at the "thread.allocated" 
and "thread.deallocated" mallctl() interfaces in the man page:

        
http://www.canonware.com/download/jemalloc/jemalloc-latest/doc/jemalloc.html

There is a relevant test program included with jemalloc:

        https://github.com/jemalloc/jemalloc/blob/dev/test/allocated.c

Jason
_______________________________________________
jemalloc-discuss mailing list
[email protected]
http://www.canonware.com/mailman/listinfo/jemalloc-discuss

Reply via email to