This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Java in General and the fly likes can we force Garbare 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 "can we force Garbare collector" Watch "can we force Garbare collector" New topic
Author

can we force Garbare collector

geetu sisodia
Greenhorn

Joined: Nov 26, 2006
Posts: 3
Please let me know if we can force garbage collector to disallocate memory of objects.
suji kumar
Greenhorn

Joined: Nov 08, 2006
Posts: 10
No, we cant force garbage collector to do deallocate memory,only we can request garbage collector to do so(using System.gc() ), but there is no guarantee tht garbage collector deallocates memory when request is passed to it.
Amod Mulay
Ranch Hand

Joined: Apr 06, 2006
Posts: 33
I don't think you can force garbage collection.
you can do Runtime.getRuntime.gc()
or System.gc().
this will instruct the virtual machine to garbage collect but it is not necessary that JVM will do it immediately....

Cheers
Amod
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: can we force Garbare collector
 
Similar Threads
Garbage Collector Question
finalize () method
Garbage collector
Forcing garbage collector
finalize() not only for GC eligible Objects?