Java Linux Process memory footprint with and without -Xmx
I have questions about some strange behavior I am seeing with Java 5.0 on Linux.
First here is the environment: Code:
[~]:> uname -a Wait.java: Code:
import java.lang.*; Code:
[~]:> java -classpath . Wait & Top however, seems to be showing me that I am only using 10 megs. Code:
[~]:> top -bp 30841 Code:
[~]:> java -classpath . -Xms64m -Xmx64m Wait & Code:
[~]:> pmap 30894 | tail -1 Then I run top on the process: Code:
[~]:> top -bp 30894 So what is going on here? 1) Why is top and pmap showing different values between the SIZE (top) and the writeable/private (pmap) ? 2) if the value in pmap is correct, why if I don't specify the max heap is it not taking the document default value?: From the Java documentation: Quote:
|
two things:
#1: You could be wasting memory importing java.lang.*, and, even so, its imported by default anyway. Assume, for clarity, that kB = kilobyte and kb = kilobit, and mB = megabyte and mb is megabyte. #2: pmap is returning a value in kilobits, not kilobytes. Its not *actually* 191.67 MBs- if you want MBs then its really 23.96 MB. So from that, we should be able to deduce that top is giving us our usage value in kilobytes. Hopefully that should explain why the numbers were so different ;-) (Note: 8 bits=1 byte, so kb/8 = kB. ) More info: http://en.wikipedia.org/wiki/Byte http://en.wikipedia.org/wiki/Bit |
Quote:
But why is pmap showing 23.96 MB and Top is showing 10 MB? Joe |
Quote:
Anyway, the import statement in java has no visible effect on the resulting application memory footprint. It is mostly a source code terseness convenience. Quote:
One should use uppercase M to mean Mega. Quote:
pmap is certainly returning values in bytes so these Ks are kiloBytes. |
Quote:
Thanks, Joe |
There can be many reasons, including you are comparing java heap size, physical, virtual and possibly multiply times mapped memory.
I can't tell much more as you only show pmap last output line. |
All times are GMT -5. The time now is 08:16 PM. |