Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > jvm memory usage on Linux

Thread Tools

jvm memory usage on Linux

Posts: n/a

I have a program where the main program runs a TimerTask every 10 sec. I have
observed that the memory usage when running the commands " top" and "ps -aux"
on the Linux box slowly increases. Over the time span of 3 hours Linux reports
that the java process has grown approx 30kb. I have started the java process
with the options -Xmx32M and -Xms32M (as it is running on a small hardware
platfrom) and I can see that by using the Runtime.getRuntime() the jvm's memory
usage looks fine:

Total : 33357824
Max : 33357824
Free : 24832448
Used : 8525376

When looking at the top command following is displayed:
1544 root S 38180 1 0.0 32.2 java

And the ps command:
1544 root 38180 S java -Xmx32m -Xms32m main

There are a couple of things that I don't understand:

1. Why the Java process seems to increase in memory usage and it doesn't ever
decrease again. The program needs to run 24/7 and I'm not sure if it will do
this at the moment. Could this have something to do with Java program or could
it be related to the JVM. I have tried it with Java 1.5 and Java 1.6 on Debain
and another Linux distro with the same result.

2. Why Linux reports the java process uses 38180kb, when I have limited the
java heap to 32Mb.

3. Why it increaes the memory when Java clealy have enough, is this maybe
related to os resoures like files, sockets, etc?

Any Help would be greatly appriciated.



Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
jvm memory usage on Linux tlo Java 8 07-23-2007 10:30 AM
Number of threads with respect to JVM memory (1.5b2 running on 2.6 linux) Soeren Gerlach Java 0 07-15-2004 11:01 AM
MS JVM and Sun JVM problem Young-Jin Lee Java 3 01-21-2004 04:25 AM
Different behavior for newStringUTF() for Sun JVM and IBM Jvm Lasse Java 1 01-05-2004 07:49 PM
Re: Handling both MS JVM and Sun JVM Kevin Hooke Java 2 09-02-2003 05:31 AM