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.

有帮助吗?

解决方案

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

其他提示

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top