Reputation: 14428
Any given point of time, how can i get the memory size utilized by each thread?
Upvotes: 1
Views: 424
Reputation: 634
To check the thread's stack size you could use non-portable GNU extension pthread_getattr_np and also you could check /proc/self/maps (or /proc/PID/maps) but this way is more complex.
Upvotes: 0
Reputation: 12866
If all you want is a heap profiler consider Google performance tools with their own allocator TCMalloc.
http://code.google.com/p/google-perftools/
An alternative high performance allocator is jemalloc which provides statistics reporting including per-thread cache bin details with malloc_stats_print()
http://www.canonware.com/jemalloc/index.html
Upvotes: 2