Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Virtual Machine / August 2006

Tip: Looking for answers? Try searching our database.

Java VM Question

Thread view: 
GNS - 17 Aug 2006 20:18 GMT
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.  From totalMemory() and freeMemory() method
calls I could see that there did not 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.
Ben_ - 17 Aug 2006 21:00 GMT
I don't 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).
Matthias Ernst - 19 Aug 2006 11:50 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.