[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
ehcache as temporary storage and hit Memory Leak  XML
Forum Index -> Ehcache
Author Message


Joined: 10/20/2010 21:05:11
Messages: 2

i use ehCache as a temporary memory stack (serves as a cache). No serializable, just String Object.

All incoming HTTP request data are store in ehcache. And there is a asynch scheduler process that takes the data from ehcache by "getKeys()" and remove the key/value by removeElement(element) after storing them into a proprietary Database.

This system runs fine and smooth but when the system runs for sometime (1 hour), the memory was fully utilized (2.5GB) and all CPU time was taken to perform GC.

The asynch process log the remaining size of the cache everytime it start. The cache.getSize() maintain at around Max:3500, and Min:300 when it finish it work.

I thought there is a Memory Leak on this application. so i used Eclipse MAT to look at the Heap Dump (on a smaller memory utilization to avoid parsing 2.5GB of data). After running the Suspect Report, i got these comments from MAT:

One instance of "org.apache.catalina.session.StandardManager" loaded by "org.apache.catalina.loader.StandardClassLoader @ 0x853f0280" occupies 73,407,072 (76.05%) bytes. The memory is accumulated in one instance of "java.util.concurrent.ConcurrentHashMap$Segment[]" loaded by "<system class loader>". 

and i found out that many empty collections that is not GC from the Top Consumer report:
Detected the following empty collections:

24,692 instances of java.util.Hashtable retain >= 4,345,728 bytes.
393,990 instances of java.util.concurrent.ConcurrentHashMap$Segment retain >= 50,430,720 bytes.

All the variable that related to the ehcache are at class's method level and no static define on them.

Any idea why GC unable to clean the cache?

Version of ehcache = 2.2.0


Joined: 09/15/2009 18:01:23
Messages: 179
Location: Brisbane, Australia

What version of Ehcache are you using?


Joined: 10/20/2010 21:05:11
Messages: 2

What version of Ehcache are you using? 

I am using ehcache-2.2.0


Joined: 10/15/2010 13:05:54
Messages: 14

Just a try please
Can u check the permsize parameter is set or not.
I am asking this bcoz normally classloading happens in that place and is not a part of the max heap size which can definitely bring down the objects in the heap as class will be getting loaded in the differnt space which will be mentioned in the permsize.

Few clarifications:
Did u notice any full GC to happen in the log
Hope there was a OOM issue, then also please share the log



Joined: 07/04/2011 04:36:10
Messages: 1491

Issue seems to be resolved.Please let us know if more information is required.

Rakesh Joshi
Senior Consultant


Joined: 07/18/2016 15:39:19
Messages: 1

We are using ehcache-2.7.4 , the objects in the cache are not getting garbage collected.

One instance of "net.sf.ehcache.store.chm.SelectableConcurrentHashMap" loaded by "weblogic.utils.classloaders.GenericClassLoader @ 0x7014a3680" occupies 457,612,800 (22.48%) bytes. The memory is accumulated in one instance of "net.sf.ehcache.store.chm.SelectableConcurrentHashMap$Segment[]" loaded by "weblogic.utils.classloaders.GenericClassLoader @ 0x7014a3680".

The server needs to be restarted again and again , please provide suggestions .
Forum Index -> Ehcache
Go to:   
Powered by JForum 2.1.7 © JForum Team