tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralph Einfeldt" <>
Subject AW: tomcat is crashing
Date Fri, 28 Sep 2001 05:54:52 GMT
You have to separate two different things:
 - Memory usage of the VM
 - The free Memory inside the VM
It depends on the operating system and the implementation
of the VM wether memory that is freed by the gc is returned
to the operation system. I haven't seen a VM that is doing
this under linux (Under Windows I haven't used Java for 
some time, so I can't say anything for this plattform).

So a VM starts with the memory usage that needed to hold
the initial heap. If the application consumes enough memory
the VM will request memory until it reaches the maximal 
heap size. The space that is freed by the gc is free memory
inside the VM.

If you want to see how much memory is free inside the VM
you can use something like this:

Runtime cRuntime = Runtime.getRuntime();

YourFavoriteLogger.log("Memory usage: used=" + 
                       (cRuntime.totalMemory() - 
                        cRuntime.freeMemory()) +
                       "; total=" + cRuntime.totalMemory() +
                       "; free=" + cRuntime.freeMemory());

If you want to track down where the memory is used you have 
to use tools like JProbe or OptimzeIt.    

> -----Urspr√ľngliche Nachricht-----
> Von: Haresh Gujarathi []
> Gesendet: Donnerstag, 27. September 2001 19:52
> An:;
> Betreff: RE: tomcat is crashing
> 1. Why the xml processing is taking so much of the memory
> 2. Quite a few times I stopped the tests when the memory used 
> by the tomcat
> threads reached say from 10Mb to 40MB. The whole system is 
> still running
> fine. Even after waiting for couple of hours this memory does 
> not seem to be
> released.
> If I again start the test, the memory space utilized by the 
> threads would
> start growing from 40MB onwards.
> 3. why does not the Garbage collector start its operation and 
> free up some
> memory.
> (Well I understand that the GC may not run at all if there is 
> still some
> memory available)

View raw message