【发布时间】:2013-12-05 18:38:57
【问题描述】:
由于具有以下配置的 EhCache,我在性能环境中面临内存泄漏问题:
<cache name="mycache"
maxElementsInMemory="50000"
eternal="false"
timeToIdleSeconds="300"
timeToLiveSeconds="0"
overflowToDisk="false"
diskPersistent="false"
memoryStoreEvictionPolicy="LRU"
/>
我进行了堆转储并尝试使用 IBM Heap Analyzer 分析泄漏的原因。 IBM 堆分析器怀疑内存泄漏,信息如下:
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
我的对象(存储在 ehcache 中)大小为 88 字节。
根据这些信息,我无法理解在这种情况下内存泄漏的实际原因是什么。
我的对象没有从缓存中刷新/删除吗? 我的 ehcache 配置有什么奇怪的地方吗? 如果对象没有从缓存中删除,可能是什么原因?
有什么想法吗?
【问题讨论】:
-
我觉得这个问题和你的类似:stackoverflow.com/questions/8595492/…我不是 ehcache 专家,但你尝试将它更新到最新版本吗?
标签: java memory-leaks ehcache