tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kurt Bernhard Pruenner <l...@gmx.at>
Subject Re: Java process: memory
Date Fri, 29 Sep 2000 16:28:10 GMT
"svignal, Aptilon.com" wrote:
> Is someone can explain me why the memory take by the process java increase
> the more I launch servlet.
> example: If I refresh the same servlet x times, the memory needed by java
> increase each time.
> Why JAVA process doesn't stay a little bit stable in terms of memory used.

Well, seems like you haven't used JAVA much, yet...

The Java Virtual Machine that runs Tomcat is using a garbage collector to
remove objects from memory instead of direct "delete" or "free" calls that
immediately free the memory used by those objects, which saves developers a
lot of headaches caused by memory leaks and prematurely freed objects and the
like.

The drawback of this approach is, of course, that no memory gets freed until
the garbage collector has done its work, and currently it only kicks in when
there's no memory left when a new object is created, or when you call the
garbage collector yourself. "No memory left" in this case means that the JVM
has hit the upper heap size limit (usually 64MB) that was set for it; you can
change that with the commandline switch "-Xmx nnM", try "java -X" for help or
look into the tools documentation that should have come with your JVM.

The reason why the JVM's memory usage seems to be growing unstoppably is that
the JVM doesn't allocate all that memory when it's started, but makes it's
heap grow when neccessary... but again, you can set the initial heap size with
another command line switch, "-Xms"...

-- 
Kurt Pruenner - Haendelstrasse 17 - 4020 Linz - Austria
http://www.mp3.com/Leak - http://www.ssw.uni-linz.ac.at

np: Leak - Coral Grove (Leaked)

Mime
View raw message