Search code examples
javamemory-leaksderby

Is this a memory leak? Over 400.000 unreachable instances of org.apache.derby.impl.store.raw.data.StoredRecordHeader


I had my application running over the weekend and on monday I was greeted by a Java heap space exception.

I analyzed the heap dump and noticed that there where over 400.000 instances of org.apache.derby.impl.store.raw.data.StoredRecordHeader marked as unreachable objects.

Does anyone know if this could explain the memory error?

Edit:

After analyizing for half of the day I am not sure that the

StoredRecordHeader

instances are responsible for the Java heap exception but I have no clue why this is happening.

Are there some kind of caching mechanism in Derby that I'm unaware of?

Are 512MB max RAM to less for Derby to work stable?

Can I somehow modify the max size of the derby cache?


Solution

  • Unreachable instances should be removed by Garbage Collector and are certainly not a reason for OutOfMemoryError. This error happens when your application has too many objects, that are reachable from GC roots and thus GC cannot throw them away. More information can be found here: Plumbr encyclopaedia.

    In order to find root cause for memory leak or any memory exhaustion situation, it is usually much easier to use some specialised tool, such as Plumbr or Eclipse memory analyzer.