Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JVM Default Garbage Collector

 
Sri Harsha Yenuganti
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apart from using jconsole, Is there any location/configuration file that I can look at to know the garbage collector thats in use ? Or Can I print the name of the garbage collector in use using any JVM Command/options?
 
Campbell Ritchie
Sheriff
Posts: 48445
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Too difficult a question for "beginning Java". Moving thread.
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I was studying for SCJP in any moment they mention this. They say that all you need to know is that you can sugest to the Garbage Collection to take action.

And nothing more...

Why would you want such thing?
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the following command: java -verbose:gc className
 
Sri Harsha Yenuganti
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hebert Coelho wrote:When I was studying for SCJP in any moment they mention this. They say that all you need to know is that you can sugest to the Garbage Collection to take action.

And nothing more...

Why would you want such thing?


My application is running fine on JDK 1.6 Update 14(Oracle WebLogic 11g(10.3.2) ) . But my app server JVM is getting crashed on JDK 1.6 Update 12(Oracle Weblogic 10.3.0).
From Update 14, Sun has implemented a new G1 garbage collector. I just want to know whether the crash is due to the garbage collector in JDK 1.6 update 12 because from the JDK 1.6 documentation I can see that there is some bug in the CMS garbage collector which corrupts the heap and crashes the JVM.

I want to check the name of the garbage collector in both the versions to see if they are using the same default garbage collector.




 
Sri Harsha Yenuganti
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wouter Oet wrote:You can use the following command: java -verbose:gc className


This command simply doesn't work !!
 
Sri Harsha Yenuganti
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I know which is the default garbage collector for every update of JDK? Can I see this information in any documentation from Sun ?
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sri Harsha Yenuganti wrote:This command simply doesn't work !!

Actually it does work but it gives other results then you asking for (I later realized). It shows which gc'tor clears how much memory and how long it took to do that. But I don't know how to get their names.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic