Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Re: Memory Leaks

Philipp Taprogge

2004-01-14

Replies:

Hi!

Shapira, Yoav wrote:

> This is a common misconception: System.gc() is merely a suggestion to
> the VM to run collection. The VM is not obliged to run it then, i.e.
> this is not a hard directive. It should never be relied upon. With JDK
> 1.4, there's a runtime parameter to ignore System.gc() calls and that
> parameter may be on by default in the future.

Also, calling System.gc() is unnecessary in allmost all cases it is
used. The VM does a far better job in determining when the gc should run
than most programmers could. Only if you know your way around in the
internals of the VM and you know that it will not run a gc cycle that
would beneficial, you can call System.gc() to politely ask the VM to do
so. Still no garantees, though.
In any case, although a call to System.cg() will most likely no hurt
your performance, you should never ever rely on it.

 Phil

--
And on the seventh day, He exited from append mode.
(Book of create(2), line 255)


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)



©2008 junlu.com - Jax Systems, LLC, U.S.A.