• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

garbage collection

 
wei liu
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. How can you force garbage collection?
[a] Garbage collection cannot be forced
[b] Call System.gc().
[c] Call Runtime.gc().
[d] Set all references to null.
Answer 1
[a] Garbage collection cannot be forced
i think garbage collection canbe forced by calling System.gc()or Runtime.gc(). m I wrong?
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no it cannot be forced you can just tell the gc you would like it to run but nothing is guaranteed...
Try to search the forum for "force garbage collection" you'll find some good discussion about the subject...
HIH
------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform
 
Vikrama Sanjeeva
Ranch Hand
Posts: 760
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One can request to Sir Garabage Collection could you please run, rather then forcing, Mr.Garabage Collection Run Now!
What do u think Valentin?.
Bye.
Viki.

------------------
Count the flowers of ur garden,NOT the leafs which falls away!
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
not only it is what I think but it is how it is
some useful links:
http://www.javaranch.com/ubb/Forum24/HTML/012281.html
Reference Objects and Garbage Collection
HIH

------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform
 
Vikrama Sanjeeva
Ranch Hand
Posts: 760
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just have done an overview of the article.It seems me good.
Thanx.
Bye.
Viki.
------------------
Count the flowers of ur garden,NOT the leafs which falls away!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic