I am facing memory leak issue in my performance environment due to EhCache with below configuraiton:
<cache name="mycache"
maxElementsInMemory="50000"
eternal="false"
timeToIdleSeconds="300"
timeToLiveSeconds="0"
overflowToDisk="false"
diskPersistent="false"
memoryStoreEvictionPolicy="LRU"
/>
I took the heap dump and trying to analyze the cause of leak using IBM Heap Analyzer. IBM Heap analyzer suspected memory leak with below information:
Leak suspect: 576,690,536 bytes (83.16 %) of Java heap is used by 128 instances of net/sf/ehcache/store/chm/SelectableConcurrentHashMap$Segment
Contains an instance) of the leak suspect: - org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBean holding 117,109,616 bytes at 0x1b6fb410
Total size: 576,690,536 bytes
Size: 528 bytes
My object (which is stored in ehcache) size is 88 bytes.
With this information I am not able to understand what can be the actual cause of memory leak in this case.
Are my objects not being flushed/removed from cache? Is there any thing odd in my ehcache configuration? If object is not being removed from cache, what can be the reason?
Any Idea?