Higher Memory Usage in JAVA 1.42 ?

L

LinuxWorld

Hello,

We moved from JAVA 1.31 to JAVA 1.42 on HP UX and we are seeing the JVM
memory size increase from 30 MB to 120 MB. We used the unix command -
"top" to see the memory usage. We used the value given under the "RES"
column.

The analysis using HPJtune shows that we are using only around 7 MB
memory. Garbage collection seems to be normal. There seems to be a
discrepancy between what "HPJtune" and "top" is showing.

We were not using any start-up parameters but then we tried with Xmx64m
, etc, but it didn't make any difference.

Has anyone else seen this ? Has anyone else seen a memory usage
increase in JAVA 1.42. Any ideas on how to get back the memory usage to
around 30M.

Thanks.
 
I

Ingo R. Homann

Hi,
Hello,

We moved from JAVA 1.31 to JAVA 1.42 on HP UX and we are seeing the JVM
memory size increase from 30 MB to 120 MB. We used the unix command -
"top" to see the memory usage. We used the value given under the "RES"
column.

The analysis using HPJtune shows that we are using only around 7 MB
memory. Garbage collection seems to be normal. There seems to be a
discrepancy between what "HPJtune" and "top" is showing.

We were not using any start-up parameters but then we tried with Xmx64m
, etc, but it didn't make any difference.

Has anyone else seen this ? Has anyone else seen a memory usage
increase in JAVA 1.42. Any ideas on how to get back the memory usage to
around 30M.

Old java versions (IIRC before 1.5) do not give back memory to the os
even if they do not need it any longer. If it needs 120 MB for a short
time, the JVM will occupy this 120MB until it is terminated.

I guess, HPJtune will recognize only the memory that is currently in use
(namely 7MB) and not the peak of 120MB that was used somewhere in the past.

Ciao,
Ingo
 
S

Steve W. Jackson

Ingo R. Homann said:
Hi,


Old java versions (IIRC before 1.5) do not give back memory to the os
even if they do not need it any longer. If it needs 120 MB for a short
time, the JVM will occupy this 120MB until it is terminated.

This is not correct.

Earlier versions of Java were less efficient in their memory usage and
garbage collection in numerous ways, but they did NOT keep heap memory
until termination. The Java heap enlarges according to set rules when
necessary. And those rules also have provisions that allow the heap to
shrink after garbage collection if it's reasonable to do so. But it is
possible, via switches to the JVM, to impact the amount of memory used.
If -Xmx and -Xms switches are used and set at the same value, then the
heap size will be constant throughout the life of the JVM, for example.
Otherwise, failure to release heap memory after usage frequently means
you've got a problem where you've failed to free some references to
objects so that they are not in fact being garbage collected.
I guess, HPJtune will recognize only the memory that is currently in use
(namely 7MB) and not the peak of 120MB that was used somewhere in the past.

Ciao,
Ingo

I don't recall seeing any increase in memory usage back when we switched
from 1.3.1 to 1.4 and later (we still use 1.4.2). I do know that there
were some major improvements in garbage collection, partly due to
improvements in Sun's JVM and partly due to improvements in our own
knowledge and understanding that led to tuning of parameters. I also
know that "top" does not give an accurate picture of JVM memory usage.

= Steve =
 
L

LinuxWorld

I am really suprised to hear that the memory usage didn't increase with
JAVA 1.42. I have read many postings at sun.com that mention a
significant increase in memory usage. Can you let me know what start-up
parameters you used for the JVM and which unix system you are running
on. Greatly appreciate your help.

Thanx.
 
A

Adam Maass

Steve W. Jackson said:
This is not correct.

Earlier versions of Java were less efficient in their memory usage and
garbage collection in numerous ways, but they did NOT keep heap memory
until termination. The Java heap enlarges according to set rules when
necessary. And those rules also have provisions that allow the heap to
shrink after garbage collection if it's reasonable to do so. But it is
possible, via switches to the JVM, to impact the amount of memory used.
If -Xmx and -Xms switches are used and set at the same value, then the
heap size will be constant throughout the life of the JVM, for example.
Otherwise, failure to release heap memory after usage frequently means
you've got a problem where you've failed to free some references to
objects so that they are not in fact being garbage collected.

Some versions of the VM, once they were allocated RAM by the OS, never
released the RAM back to the OS, even if the total requirements for the heap
became very small after an initial burst. I believe it is this behavior that
the OP is seeing.

-- Adam Maass
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top