I have a C++ applicaion that is running as a daemon. The way I check the memory consumption is

top -p <pid>
I have noticed that "Reident Memory" is continously increasing on certain operation. Is there any easy to find out memory leak on linux.

If Valgrind is the way to go, how can I run it against the c++ daemon
Who is Participating?
jkrConnect With a Mentor Commented:
Yes, that will take a while, yet it is the safest method. You could try limiting the area to search to '/usr' to save time.
learningunixAuthor Commented:
When I run the command:

valgrind --tool=memcheck --leak-check=yes myDaemon_g --log-file=valgrind.log

it fails with

error while loading shared libraries: cannot open shared object file: No such file or directory

what does this mean usually? do I have to set LD_LIBRARY_PATH? is there any easy way to find where this resides on the system
Yes, that means that the lib in question is either not present or your LD_LIBRARY_PATH environment variable does not contain the directory it resides in. The simplest way to locate that lib would be to run

find / -name -print


find / -name "libxyz*" -print
learningunixAuthor Commented:
find / this will take forever. I thought there was some other easy way to do it
learningunixAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.