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 / April 2006

Tip: Looking for answers? Try searching our database.

java.lang.OutOfMemoryError: Java heap space - with Loads of free heap

Thread view: 
masseyis@gmail.com - 25 Apr 2006 14:55 GMT
HI,
has anyone seen this? I have a multithreaded app, using Postgres JDBC
running on Solaris - Java HotSpot(TM) 64-Bit Server VM (build
1.5.0_05-b05, mixed mode). Randomly, I get the
j"ava.lang.OutOfMemoryError: Java heap space". But Checking it,
Runtime.freeMemory, JConsole and YourKit all say that The heap is using
200Mb when -Xmx is 400Mb. The machine has 1 Gb of RAM, and should
easily be able to malloc more memory for the VM.

Does anybody have any clues? This is really confusing me.

Thanks in advance.

James.
Ben_ - 25 Apr 2006 17:10 GMT
Hello,

Fragmented heap can be a cause: there are many spaces of heap available and
the sum of them makes you think that there is plenty of free mem (which is
the case), but there is not enough contiguous memory to allocate a large
object.

So, for example, you may very well be able to allocate 10 String objects of
1 MB, but cannot allocate a single 3 MB String object.

There is a good discussion of this in IBM JVM Diagnostic Guide
(www.ibm.com/developerworks/java/jdk/diagnosis). It's IBM implementation,
but it's interesting as it's very much detailed.
Thomas Hawtin - 26 Apr 2006 15:30 GMT
> has anyone seen this? I have a multithreaded app, using Postgres JDBC
> running on Solaris - Java HotSpot(TM) 64-Bit Server VM (build
[quoted text clipped - 3 lines]
> 200Mb when -Xmx is 400Mb. The machine has 1 Gb of RAM, and should
> easily be able to malloc more memory for the VM.

It is possible that somewhere is attempting to allocate more than 200 MB
at once. Also there have been problems with the permanent generation
(class files, compiled code and interned strings) not being fully
garbage collected before the OOME is thrown (fixed in very recent 1.6
builds, apparently). Mainly a GUI problem, but sometimes OOME can be
thrown due to running out of some other resource, such as GDI space on
Windows.

Tom Hawtin
Signature

Unemployed English Java programmer
http://jroller.com/page/tackline/



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.