【问题标题】:Memory leak issue due to EHCache由于 EHCache 导致的内存泄漏问题
【发布时间】: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 配置有什么奇怪的地方吗? 如果对象没有从缓存中删除,可能是什么原因?

有什么想法吗?

【问题讨论】:

标签: java memory-leaks ehcache


【解决方案1】:

设置timeToLiveSeconds = &lt;no of seconds&gt;。应该大于 0。

【讨论】:

    猜你喜欢
    • 2016-02-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-10
    • 1970-01-01
    • 2011-03-03
    • 1970-01-01
    • 2013-07-23
    相关资源
    最近更新 更多