On Wed, 20 Apr 2005 13:48:48 +0100, <> wrote:
> In reality, the garbage-collector will only start to free memory
> if the memory on the computer is starting to run out (!).
That's not true, it depends on the JVM implementation (the JVM spec. does
not define how a garbage collector should behave) and its configuration.
Generally the heap cannot grow beyond a pre-configured maximum (-Xmx on
Sun VMs) so it will not use all of the computer's memory (unless you have
configured the heap to be allowed to grow that big).
Sun's VMs will increase the heap size as required but never reduce it.
With this behaviour the heap size would rapidly hit the maximum permitted
if they didn't ever perform garbage collection before the limit is reached.
System.gc() doesn't guarantee garbage collection will be performed, but it
usually is performed when this call is made.
Dan.
--
Daniel Dyer
http://www.footballpredictions.net