Sagewire Logo

JAVA VM Question

3 Message(s) by 3 Author(s) originally posted in java machine


From: GNS Date:   Thursday, August 17, 2006
I've a JAVA web application running on Sun Solaris 10 platform, the
JAVA version is 1.5.0. Recently I found when I used TOP command to get
the memory used by my application it was over 1.5GB and kept
increasing. However when using the JAVA.lang.Runtime.totalMemory() and
freeMemory() method s from my code the memory usage was way lower than
the size reported by TOP. From totalMemory() and freeMemory() method
calls I could see that there didn't seem to have a memory leak in my
code and the GC was working properly however memory use reported by TOP

never decreased meaning that the GC never got kicked off???

Thanks, Richard.


From: Ben_ Date:   Thursday, August 17, 2006
I do not know the internals of this particular implementation, but I know
that some JVM implementations never release the memory to the Operating
System, even when the heap was shrunk.

What you see with Runtime.totalMemory is the size of the heap. What you see
with top is the size of the process, for which the JAVA heap accounts for
most of the size, but not all (memory allocated by native code, etc).


From: Matthias Ernst Date:   Saturday, August 19, 2006
Hi GNS,

I have a JAVA web application running on Sun Solaris 10 platform, the
JAVA version is 1.5.0. Recently I found when I used TOP command to get
the memory used by my application it was over 1.5GB and kept
increasing. However when using the JAVA.lang.Runtime.totalMemory() and
freeMemory() methods from my code the memory usage was way lower than
the size reported by TOP.



By any chance, are you using File.deleteOnExit()? The method "leaks" memory
in native space outside the JAVA heap - deleting such a file yourself does
not free that registration. Very hard to diagnose.

See
http://www.bobcongdon.net/blog/2005/07/filedeleteonexit-is-evil.html or http://blogs.sun.com/roller/page/chegar?entry=diagnosing_deleteonexit_issues

Matthias



Next Message: JIT compiler's docs


Blogs related to JAVA VM Question

JAVA BASIC QUESTIONS
The Java interpreter is used for the execution of the source code. ... The string "question #6", with its top-left corner at 10,0 ... 3) Once when the class is first loaded into the Java virtual machine. ...

Comment on PHP interview questions, Part 1 by admin
If the table has an index for the columns in question, MySQL can quickly ... How can I embed a java programme in php file and what changeshave to be done in php.ini file? ... The JVM is created using JNI, and everything runs in-process. ...

Removing Features From J2SE
There's always been a looming question of how large the Java language and platform ... The Java Virtual Machine also includes the class file format, ... I know that running older Java applications in a newer JVM provides all of the ...

18 reasons why java should not be open source
I remember a Sun representative fielding questions about EJB3 and why there ... Most people calling for java to be open source do not need it to be open ... of various things (the JVM, the JDK etc) on the java platform one would be ...

Test Java Virtual Machine (Citizenship test questions)
See if the Java Virtual Machine (JVM) is working properly on your computer. This Java technology Test your Java Virtual Machine (JVM) This article applies to: ... CDL Driver CDL Test Question CDRom Testing even testers need testing. ...

Performance Anxiety
... the lead of the Smalltalk and Java virtual machine team at Object ... for the early releases of IBM/VisualAge for Java, and the J9 Java VM. ... These costs were paid whether the code in question was executed once or a million times. ...


Programming | Sports | Autos

copyright 2006
Valid XHTML 1.0 Transitional