0

I am running a Web Based Java Application on JBoss and Ofbiz. When I did memory profiling of the JVM using VisualVM I found that a huge amount of classes and their objects are getting uploaded to the heap, but not getting cleared/unloaded after the application terminates.

I understand that JVM does automatic Garbage Collection, which should ensure the heap is cleared after the program terminates.

JBoss and Ofbiz are supposed to run all the time. But it seems to clear heap we have to restart all these apps and start fresh again. But our application is supposed to be live 24x7.

Can you please tllme what can be the issue here? I am not sure what all things I should monitor to get to the root issue.

kajarigd
  • 1,299
  • 3
  • 28
  • 46

1 Answers1

0

Not necessarily. JVM need not clear immediately after an app is unloaded. It will clear only when its needed or when its idle (depending on the collector used). Sometimes it could be immediate, sometimes it can take a few minutes.

You can try tuning the garbage collection for your hardware (JBoss start options). Documentation is available here http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html

When you unload an app, it will wait until all its thread stops. So ensure that all process (scheduled jobs, pending db calls) ended gracefully.

Also check min and max heap space options used for your app server. Memory usage need not go below the minimum allocation size.

Jp Vinjamoori
  • 1,173
  • 5
  • 16
  • Thanks for the pointers! I am using VisualVM to check the memory usage. Since JBoss and Ofbiz are continuously running, I could see many classes are still loaded in the memory and many threads are also alive. I don't know how to understand, which classes and threads belong to which application. Is there any profiler tool that will help me get that info? – kajarigd Jul 29 '14 at 06:27
  • Try Net Beans profiler https://profiler.netbeans.org Following article talks about memory leak detection in detail may be useful to you http://www.oracle.com/technetwork/java/javase/tooldescr-136044.html – Jp Vinjamoori Aug 13 '14 at 04:34