Question

Like the title says I'm interested if I can see per thread memory usage on programs compiled with -ltcmalloc. AFAIK with regular malloc memory is linked to process not to thread, but I'm not sure about tcmalloc.

Was it helpful?

Solution

There is no such thing as per-thread memory usage. Memory is a process resource.

OTHER TIPS

TcMalloc has some per-thread memory caches. But they are just a proxy to a shared heap (to reduce the congestion). All the memory in tcmalloc comes from a single shared pool.

Alive (allocated) memory may be passed freely from one thread to the other, so it's not easy to say which thread uses it.

You could monitor which thread allocated the used memory, but you would need either completely separated memory pools (not very elastic) or some per-allocation memory overhead. Neither of those is present in tcmalloc...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top