How to find memory leaks using visualvm

Analysing memory leak using visualvm is not that easy. It has a tool/plugin called ‘sampler’. This can be used to sample memory or cpu. You can take snapshot at regular interval and look for possible leaks. Here is some details on how to use it- Obtained from quick search

More effective way will be to get a heap dump (say when the application has slowed down or when OOM happens). VisualVM help you to take heapdump (using Heap Dump on Monitor tab)

This file can be analysed by MAT– Some details are here at How do I analyze a .hprof file?

Leave a Comment