my dog learned polymorphism
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes question on GC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "question on GC" Watch "question on GC" New topic

question on GC

sanjana narayanan
Ranch Hand

Joined: Nov 25, 2003
Posts: 142
can someone tell me the difference between System.gc and Runtime.gc().?
Derek Baker
Ranch Hand

Joined: May 23, 2003
Posts: 46
From the API docs:

The call System.gc() is effectively equivalent to the call:

The method System.gc() is the conventional and convenient means of invoking this method (Runtime.getRuntime().gc()).
Sumitro Palit
Ranch Hand

Joined: Dec 13, 2003
Posts: 37
There is no difference.
System.gc calls Runtime.gc
Check your installed jdk's source code.
You'll find has the gc method as follows:
public static void gc() {
"Simplicity is virtue"
sanjana narayanan
Ranch Hand

Joined: Nov 25, 2003
Posts: 142
Thanks for the reply..
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: question on GC
It's not a secret anymore!