• Post Reply Bookmark Topic Watch Topic
  • New Topic

Total Loaded Classes is Increasing During Runtime according to JVisualVM  RSS feed

 
Matt Taylor
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys, I am having an Exception in thread thread_name: java.lang.OutOfMemoryError: Compressed class space

During runtime. I already check all my classes and methods used but cannot find what causes it. Later I found out about jvisual vm and tried to open it. I notice that when my tomcat is running,

my total loaded classes only keeps increasing. I'm not sure if is it normal? Sometimes it reaches 1.8gb. I am attaching a screenshot for this.

Can someone please give their opnions please. TIA
screenshot_jvm.png
[Thumbnail for screenshot_jvm.png]
 
Les Morgan
Rancher
Posts: 779
19
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it normal? Depends on your application doesn't it?

If you are not properly dereferencing your objects when you are preparing them for GC, then that is bad: you will never have your GC run to clear our your old objects because they are all still referenced.

So without seeing anything about your application, I would have to say that because you are getting undesired results, that is bad. You have some work to do to see if it is "normal" or not.
 
Matt Taylor
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I really not sure what to do next. I rechecked all my method but my application is getting "Exception in thread "commons-pool-EvictionTimer" java.lang.OutOfMemoryError: Compressed class space" after almost 2 hours of running.

I attach here the graph according to jvisual. I notice that it is not on the heap part that is the problem as I only used 606Mb when I have alloted 2Gb max heap size. The only thing i observe is the total class loaded which is high (3.6M loaded classes) while unloaded classes are only 1k. Part of my program invokes a new instance of SOAP webservice classes (uses a third party api) in a for loop. It is required and I need to invoke it. Not sure if that causes it.
Exception-in-thread-commons-pool-EvictionTimer-java.lang.OutOfMemoryError-Compressed-class-space.png
[Thumbnail for Exception-in-thread-commons-pool-EvictionTimer-java.lang.OutOfMemoryError-Compressed-class-space.png]
 
Les Morgan
Rancher
Posts: 779
19
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Matt,

Monitor what is happening in that "for loop" and see if it is invoked enough to account for the 3.6M classes. There is where I would start looking. If it is, then you are going to have to find some way of refactoring to avoid that, and if you cannot a call to the support line for the product you are using cold be in order.
[edit]
Once again, I cannot answer if that is normal or not for your application for it to grow like that. I am assuming not. You could also increase the stack space -Xss option for Java, but it is sounding like you are trying to say that you expect it is growing beyond all bounds--that is a problem where refactoring is required.
[/edit]
Les

Matt Taylor wrote:I really not sure what to do next. I rechecked all my method but my application is getting "Exception in thread "commons-pool-EvictionTimer" java.lang.OutOfMemoryError: Compressed class space" after almost 2 hours of running.

I attach here the graph according to jvisual. I notice that it is not on the heap part that is the problem as I only used 606Mb when I have alloted 2Gb max heap size. The only thing i observe is the total class loaded which is high (3.6M loaded classes) while unloaded classes are only 1k. Part of my program invokes a new instance of SOAP webservice classes (uses a third party api) in a for loop. It is required and I need to invoke it. Not sure if that causes it.
 
Dave Tolls
Ranch Foreman
Posts: 3056
37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looking at that second screenshot, your class loading levels out.
That's expected in any Java app.

How big is the SOAP model you are using?
 
Matt Taylor
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Dave Tolls

On the second screenshot, when the graph "level out" is also the time my program stops and I receive a Exception in thread "commons-pool-EvictionTimer" java.lang.OutOfMemoryError: Compressed class space
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!