Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Generic steps to identify a memory leak

DZone's Guide to

Generic steps to identify a memory leak

· Java Zone
Free Resource

Microservices! They are everywhere, or at least, the term is. When should you use a microservice architecture? What factors should be considered when making that decision? Do the benefits outweigh the costs? Why is everyone so excited about them, anyway?  Brought to you in partnership with IBM.

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.

Sharath.H

Discover how the Watson team is further developing SDKs in Java, Node.js, Python, iOS, and Android to access these services and make programming easy. Brought to you in partnership with IBM.

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}