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.

Était-ce utile?

La solution

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

Autres conseils

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...

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top