[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
From: Matthew Phillips [mailto:firstname.lastname@example.org]
Sent: Wednesday, November 13, 2002 11:09 AM
Subject: Re: Certification study group issue: Will the Garbage Collector
pick up the rubish is you call it?
Both of those methods suggest the garbage collector
should run. There is no way to force it to run.
I have never had to use either of these methods. I
assume that the advantage is that you may want to try
to run the garbage collector on a different schedule
that the JVM. The methods give you a way to attempt
to do this.
--- Lee Chalupa <email@example.com> wrote:
> Can someone give me an Amen on this issue? There
> are two parts to this issue
> Part I:
> An issue that came out of last night's meeting was
> from the following question:
> "The method System.gc forces the garbage collection
> process to run."
> True or False.
> We are not sure.
> Here is the research that I have found on the topic:
> Mike Meyers has published a few editions of his
> certification book.
> Mike Meyer's book states: "You cannot force the
> garbage collector to reclaim memory."
> He explains elsewhere: "While you cannot force the
> garbage collector to reclaim memory, you can suggest
> that it
> do so by calling the java.lang.System.gc() method or
> the java.lang.Runtime,getRunTime().gc() method.
> Both of these
> methods send a request to the garbage collector
> asking it to reclaim memory. The garbage collector
> can honor or
> ignore the request at its whim.
> I assume in other words this means that the garbage
> collection can just ignore the request and refuse to
> Here is another post I found on a java web site. I
> have no idea how credible this source is.
> " System.gc() does not mean the garbage collector is
> called, it only suggests that the VM call it."
> Part II:
> Ok. If the answer is True, then what is the value of
> invoking a method that has the discretion to
> run or not run. If it wanted to run it would run
> without me invoking the method in the first place
> wouldn't it?
> Thanks for the help.
> Lee Chalupa
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos