• Post Reply Bookmark Topic Watch Topic
  • New Topic

Garbage Collector  RSS feed

 
Juliano Sousa
Greenhorn
Posts: 6
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well with a code like this.

Joao joao = new Joao();

joao = null;

Can run the garbage collector without a call? I suppose that yes, the JVM decides when it is the best moment to run the garbage collector without a call.


What do you think?

Thank you for your time.
 
Tim Cooke
Marshal
Posts: 4051
239
Clojure IntelliJ IDE Java
  • Likes 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JVM manages the GC. End of story.
 
Juliano Sousa
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much to clarify me that! I was not sure about it. ;)
 
Campbell Ritchie
Marshal
Posts: 56578
172
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can suggest the garbage collector run with this method, but there is no guarantee that the garbage collector will actually run. Except for, “I want to try it and see what happens,” always let the JVM decide when to do its own garbage collection.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!