views:

121

answers:

1

How do I get per thread based memory consumption of a process in Linux? I understand that we can use /proc/pid/task/tid/statm, but thats not helping my case. All the threads show same value and its same as PID's statm.

We can do valgrind but I am not looking for any invalid read/write or leaks. Valgrind will not tell me any thread level info.

Any other suggestions?

EDIT: How do I profile my code? How much memory was allocated in which function/line number etc.?

+2  A: 

All the threads share the same address space and use the same heap, so except for their stack, they should all show the same memory usage.

progrmr
Thanks for the answer. Let me rephrase my question then:How do I profile my binaries at thread level? I mean, how much memory was allocated at what point in code?My threads are typically not sharing memory blocks. They just share some fds, IPC files etc.
Jack
accepting this as thats the only answer I got anyway :DI agree with the fact that its showing same mem usage. Couldn't do much beyond that..
Jack