What is garbage collection? can it be forced?

Showing Answers 1 - 21 of 21 Answers

Pranita

  • Jul 17th, 2006
 

In java deallocation is handled automatically.When there is no reference to an object exists, it means the object is no longer needed then the object is destroyed automatically is called garbage collection.Garbage collection only occurs sporadically.There is a method exists ie System.gc for garbage collection.But we can not force for the garbage collection.

  Was this answer useful?  Yes

rizwan

  • Jul 31st, 2006
 

i think its not runtime.gc its system.gc

  Was this answer useful?  Yes

devi

  • Aug 10th, 2006
 

No it can't be forced.we can only requested the jvm through System.gc()

  Was this answer useful?  Yes

javakamal1

  • Feb 27th, 2008
 

Garbage Collection(GC) is like "Removal of unwanted things from memory"
It is automatic in nature.Also GC lies in JVM...so constant monitoring of unwanted objects are scanned & removed..
It deleted that object which is out of scope or it's reference link has been deleted..

We can request GC to make a check (Not forced..it's not command..it's request to JVM)
by System.gc();

finalize() use to free up memory occupied by other resources...

  Was this answer useful?  Yes

garbage collection means releasing the memory free from the objects that can no longer be refferenced.
No it can't be forced.............. although system.gc() or whatever may request for garbage collection but when exactly it would be started is at the discretion of JVM.

  Was this answer useful?  Yes

Garbage Collection:  If no longer any obejct  need to any variable, java automatically reclaimes the memory.

U can't force the GC, U have to give the request by using system.gc() and even not guarante that its immediatly to reclaims the memory...........

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions