Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can we force Garbare collector

 
geetu sisodia
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please let me know if we can force garbage collector to disallocate memory of objects.
 
suji kumar
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic