MatBanik
MatBanik

Reputation: 26870

Solving intermittent Garbage Collection problem - Java

I have spring enterprise app running on JDK 1.6 under Windows 2008. The app gets slow or unresponsive at random times. I suspect it is memory leak and the GC is kicking into over drive.

How can I troubleshoot this without restarting JVM using java.exe -verbose:gc parameter? I really cannot shutdown this app. I'm planning on doing AppDynamics on it once I can restart it but for know what can I do? What are my options?

Upvotes: 3

Views: 357

Answers (1)

John Vint
John Vint

Reputation: 40266

Start the application and run jconsole on the PID. While its running look at the heap in the console. When it near maxes get a heap dump. Download Eclipse MAT and parse the heap dump. If you notice the retained heap size is vastly less then the actual binary file parse the heap dump with -keep_unreachable_objects being set.

If the latter is true and you are doing a full GC often you probably have some kind of leak going on. Keep in mind when I say leak I don't mean a leak where the GC cannot retain memory, rather some how you are building large objects and making them unreachable often enough to cause the GC to consume a lot of CPU time.

If you were seeing true memory leaks you would see GC Over head reached errors

Upvotes: 3

Related Questions