Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Will garbage collector run on the spot

 
Dinesh Tahiliani
Ranch Hand
Posts: 486
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

When i call Runtime.getRuntime() and System.gc() method, will garbage collector run on the spot and free the memory space . Or JVM will decide to run the garbage collector.
 
cchetan jain
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can not force to run the garbage collector..when you apply a method to run ..it depends on the jvm that it will allow the garbage collector to run or not instanty...
 
Lucas Smith
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dinesh Tahiliani wrote:Hello

When i call Runtime.getRuntime() and System.gc() method, will garbage collector run on the spot and free the memory space . Or JVM will decide to run the garbage collector.


if you call Runtime.getRuntime() you say nothing to JVM
you have to use:
Runtime.getRuntime().gc();
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic