wood burning stoves 2.0*
The moose likes Java in General and the fly likes JVM Default Garbage Collector Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "JVM Default Garbage Collector" Watch "JVM Default Garbage Collector" New topic
Author

JVM Default Garbage Collector

Sri Harsha Yenuganti
Greenhorn

Joined: Mar 02, 2010
Posts: 18
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

Joined: Oct 13, 2005
Posts: 36453
    
  15
Too difficult a question for "beginning Java". Moving thread.
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

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?


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

You can use the following command: java -verbose:gc className


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Sri Harsha Yenuganti
Greenhorn

Joined: Mar 02, 2010
Posts: 18
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

Joined: Mar 02, 2010
Posts: 18
Wouter Oet wrote:You can use the following command: java -verbose:gc className


This command simply doesn't work !!
Sri Harsha Yenuganti
Greenhorn

Joined: Mar 02, 2010
Posts: 18
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

Joined: Oct 25, 2008
Posts: 2700

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JVM Default Garbage Collector
 
Similar Threads
garbage collection
Java Questions in Interview
two threads always active in java
Finalize and System.gc()
How to free memory?