How to make valgrind displaying the memory status for daemon application?

I have a C program which contains many memory allocation even from external libraries and I want to check periodically the total allocated memory by my application (library allocations included).

I tried with some linux commands like ps euf, pmap $pid, cat /proc/$pid/status but without any real results.

I make some research and I found the adequate tool todo that is with valgrind.

I tried to dump the memory when my application is running with:

valgrind --tool=drd --trace-alloc=yes

But I did not get result like the result displayed by valgrind at the end of execution.

How to make valgrind displaying the memory status (like the result displayed by valgrind at the end of execution) when my application is running?

Upvotes: 0

Views: 786

Answers (1)

thiton
thiton

Reputation: 36059

According to the 3.8.0 valgrind manual, there is no such option for the core or for memcheck, and no mention on periodic or triggered behaviour in the signal section. valgrind can't do it out of the box.

While you might write a valgrind tool to do the job, you might re-think the approach and clarify what kind of memory usage you want, and if the system statistics might be sufficient for your task.

Upvotes: 1

Related Questions