• Post Reply Bookmark Topic Watch Topic
  • New Topic

Garbage Collection  RSS feed

 
velmurugan
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Anyone help me
What is the difference between the methods System.gc() and Runtime.gc()
 
Valery Lezhebokov
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html

The call System.gc() is effectively equivalent to the call:

Runtime.getRuntime().gc()
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But if you are indeed a beginner, you should not be calling either of them. Java will do the garbage collection as necessary. You do not need to call these methods to make it happen. In fact, these methods may not do anything at all - read their documentation carefully.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!