tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: verbose gc
Date Thu, 15 Jan 2004 15:33:42 GMT

> 1) [Full GC 34521K->15504K(38328K), 0.5953540 secs]
> [GC 27533K->16335K(38328K), 0.0396336 secs]
> 2) what does the above statements got in catalina.out means, is garbage
> collection active?

Yes, garbale collection is active. When the garbage collector runs, it 
will print a line out to stdout (or stderr?) which ends up in your 

If it runs a 'full' GC (where it takes a lot of time and cleans up a lot 
of stuff), then it'll say "Full GC", like the first example. Otherwise, 
it's doing an incremental GC and not hitting everything, like the second 
example. In a healthy syste, you should see lots of regular GCs, and 
occationally see a full GC.

The two big numbers indicate the size of the active heap (the total size 
of 'live' objects before and after the GC). So, in the first one, the 
heap was reduced from 34521k of active objects to 15505k of active 
objects. The number in parens () is the size of the non-permanent heap, 
which is the total heap minus one of the surviver spaces.

The last number is the wall-clock time that the GC was active -- it 
tools half a second to so a full GC and about 1/20 of a second to do the 
incremental GC.

Please see|outline for 
more information.

> When i execute top command on solaris and see the memory it shows  size and
> resisdent memory , what is the diference between the two.

I think this might mean different things to different OSs, but generally 
the "size" is the total size of executable + code + heap for that 
process -- everything it needs to run. The 'resident' is usually the 
amount of 'size' that's actually in physical RAM and not swapped out to 
disk by the OS.

> 3) I see that gc statements are logged to catalina.out but the memory usage
> keeps increasing, does it mean there is problem with
> garbage collection,

When you say 'memory usage', do you mean from top? Right. Java doesn't 
return memory to the OS once it requests it -- there's generally no need 
to do that. Even though Java's heap has more 'space' left over in it, it 
only has space left over for more Java objects. You should not be 
comparing the Java heap and GCs to what you read out of 'top'. You 
should use Runtime.freeMemory (the available heap size), 
Runtime.totalMemory (the total heap size + internal VM memory), and 
Runtime.maxMemory (the maximum amount of memory that the VM will try to 

> 4) can we get more information like how many obejcts created / objects
> destroyed during a gc run, what options to pass to get that information

You need a profiler to do heap inspections, which has been discussed 
many times on this list. I'm not sure you can find out exactly what the 
GC is doing... you might need a very nice profiler for that.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message