aspose file tools*
The moose likes Performance and the fly likes High memory consumption, but empty heap Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "High memory consumption, but empty heap" Watch "High memory consumption, but empty heap" New topic
Author

High memory consumption, but empty heap

Mirko Bonasorte
Ranch Hand

Joined: May 14, 2007
Posts: 244
Greetings,

I have a strange behaviour on my application. When I launch my application with -Xmx<MEM>, it seems to use all the <MEM> specified, even if I invoke the garbage collector using jconsole.
I've also tried using jprofiler and heap dump: using jprofiler, I don't see where all the memory is used, even if I have no filter; using the heap dump, I get the file the same size as the eccupied memory, but, when analyzing with jprofiler, I don't see all the allocated variables, but far less data.

I'm using Sun JDK 1.5.

Thanks in advances.


SCJP<br />SCWCD 1.4 Upgrade (Remember: me stupid)<br />SCWCD 1.4<br /><a href="http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html" target="_blank" rel="nofollow">SCBCD 5.0</a><br /><a href="http://www.enthuware.com" target="_blank" rel="nofollow">SCBCD 5.0 mock exam</a> <br /> <br />SCEA 5 Part1: Preparing...
Mirko Bonasorte
Ranch Hand

Joined: May 14, 2007
Posts: 244
Greetings,

I've got some more details about my problem: a part of (most of) the heap is NOT reachable so it should be eligible for garbage collection; instead, I get OutOfMemoryError .
I supposed it was caused by weak references, but it is not possible, because jvm should release them before throwing OutOfMemoryError.

Any idea?

Thanks in advances
Mirko Bonasorte
Ranch Hand

Joined: May 14, 2007
Posts: 244
Greetings,

I've also noticed that I have a lot of small classes referenced by java.lang.ref.Finalizer. Those classes are generated by CGLIB (I'm using Hibernate).

Any idea?
Shaozhen Ding
Greenhorn

Joined: Sep 22, 2009
Posts: 1
Perm Space should be out of the heap in JDK1.5. Do you have large libraries in WEB-INF/lib? Jprofiler should only view the memory in the heap without perm space

What kind of out of memory you have?

Do you use hot deployment? Because hot deployment with hibernate framework potentially resulted "out of memory: permSpace"
Mirko Bonasorte
Ranch Hand

Joined: May 14, 2007
Posts: 244
Greetings,
and thank you for your response.

The permgen space should be enough (I've set it to an high value).
It seems to be an hibernate problem, which
1. creates some soft references without removing them, so the garbage collector sometimes decides to remove them
2. keeps a lot of java.lang.ResultSet references because of a bug

After solving the two problems, I had no more memory consumption.

Again, thanks a lot for your support.
 
 
subject: High memory consumption, but empty heap