Does massif tool work correctly with multithreaded applications?

1.2k Views Asked by At

I am developping a multithreaded application which seems to allocate huge amounts of memory during its runtiime. All the memory gets freed in the end of execution, so valgrind shows no memory leaks. I tried to use massif tool to find out what was happening, but ms_print seems to show information only about the main thread. However, I believe that the great majority of memory is allocated in child threads. Is it possible to make massif show information about them?

2

There are 2 best solutions below

0
On

For me (Ubuntu 12.04), this seems to work by default. Like in your application, my main thread doesn't do much of anything (except handling my gtk-based UI), and all the (de)allocating is done in subthreads.

I did have some initial difficulty because I am analysing an autotools-based project, and in my first attempts I was analyzing a shell-script generated by libtool, instead of my application.

0
On

You can set --trace-children=yes [default:no]

When enabled, Valgrind will trace into sub-processes initiated via the exec system call. This is necessary for multi-process programs.

massif manual