Sharath has posted 1 posts at DZone. View Full User Profile

Generic steps to identify a memory leak

  • submit to reddit

1. Start the application with profiler options enabled.

2. Run Garbage Collector using profiler client tool.

3. Capture memory snapshot.

4. Submit request to the server application.

5. Once the job has run successfully run GC again.

6. Capture memory snapshot.

7. Compare snapshots to find if any objects are leaked.

Repeat Steps 4 to 7 with similar request.If you find an increase in memory after each successive request completion then memory leak can be suspected. Then the suspect objects can be found out by analyzing report like dominator tree objects etc and probably code fix might be necessary to prevent memory leak. Once the code fix is done, you can repeat the steps mentioned above to see if the fix has helped to resolve memory leak.


Your rating: None
Published at DZone with permission of its author, Sharath H.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Victor Tsoukanov replied on Fri, 2010/02/26 - 12:59am

One additional hint - use class filtering in profiler and start it with your own packages. While without filtering there may be a lot of information in snapshot difference, after applying filter you can reduce it to small set of your classes which may be a cause of memory leak.

Jigar Shah replied on Tue, 2010/03/02 - 5:01am

Which profiler did you use ? Any idea how to use eclipse TPTP tools to do this ? Its too complicated but free :) ?

Venkatesh Srinivas replied on Mon, 2010/04/05 - 6:06am

really good... how did u configured profiler while starting the application, what are all arguments u used before running the app ?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.