Wednesday, April 18, 2012

Finding memory leaks easily with Solaris Discovery tool


For every beginner level C/C++ developer memory leaks are the most troublesome bug to detect. I have used mdb, solaris sun studio 12 but couldnt successfully find memory leaks. Then googled and heard a tool called Discover which is aviable in Solaris express (may be in other nix aswell). It is such a cool tool in that you don't need to configure it manually, or eats up memory when running or represents data in almost cryptic memory addresses and stuff. When ran with the application, it provides the function/methos in which the leaking occurs and from that point onwards troubleshooting becomes much easier.

All you have to do is,

1. compile your app with lumem
    g++ app.cpp -lumem
2. type discover app
     #discover app
3.run app
     # ./app arg1.

and then when application exists a cool html page named app.html wiil be created in the same directory. If you are running the app again make sure to recompile and to issue 'discover app' command again before running app.

No comments:

Post a Comment