Heap consumed too large by SelectableConcurrentHashp$Segment[]

1,034 views
Skip to first unread message

no jihun

unread,
Dec 3, 2015, 4:13:21 AM12/3/15
to ehcache-users
Hello,

I am using ehcache with spring cache encapsulation.

Some problem is SelectableConcurrentHashp$Segment[] consumes too big memory.
this seems like a memory leak..


After GC. I dumped heap.

this is the cached objects count and heap size. ( PlaystoreAppVO. 450K instances cached )


what is this big heap hog.
I don't belive there exist any other cache objects except PlaystoreAppVO. ( this 10 times bigger than the  cached instance.)


more deeper..



Path to gc root of some HashEntry..



Configurations


ehcache config

 <ehcache

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

  xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd"  updateCheck="false">


  <cache

  statistics="true"

    name="preferenceVOCache" 

maxElementsInMemory="1000" 

eternal="false" 

overflowToDisk="false" 

timeToLiveSeconds="600"

memoryStoreEvictionPolicy="LRU" />


spring config


<beans xmlns="http://www.springframework.org/schema/beans"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"

xmlns:cache="http://www.springframework.org/schema/cache" xmlns:p="http://www.springframework.org/schema/p"

xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd

    http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.2.xsd

    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">

    

<cache:annotation-driven cache-manager="cacheManager" />

<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager"

p:cache-manager-ref="ehcache" />

<bean id="ehcache"

class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"

p:config-location="classpath:cache/ehcache.xml" />

</beans>


Java Code

@Cacheable(value = "playstoreAppVOCache")

public PlaystoreAppVO selectAppFromLocal(final String appPackageName) {

return selectAppFromArcus(appPackageName);

}



Application version

Spring 3.2, ehcache 2.6.0, java 1.7



What should I check?

Any advice would be great. 

thanks.

no jihun

unread,
Dec 3, 2015, 4:41:09 AM12/3/15
to ehcache-users
This produced while run junit with eclipse.

Louis Jacomet

unread,
Dec 3, 2015, 8:09:07 AM12/3/15
to ehcache-users
Hello,

The first thing I would recommend is upgrade to the latest Ehcache version in order to benefit from all bug fixes.
Latest currently is 2.10.1. If that is not an option, you must at least upgrade to the latest 2.6.x.

Regards,
Louis

On Thu, Dec 3, 2015 at 10:41 AM no jihun <jee...@gmail.com> wrote:
This produced while run  junit with eclipse.

--
You received this message because you are subscribed to the Google Groups "ehcache-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ehcache-user...@googlegroups.com.
To post to this group, send email to ehcach...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ehcache-users/9c4a456d-6233-41b5-90e7-b7b3e7c22ead%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

no jihun

unread,
Dec 3, 2015, 5:58:31 PM12/3/15
to ehcache-users
thanks.

some library have dependency with ehcache 2.6..

but I can't find any 2.6.× release notes.
https://confluence.terracotta.org/plugins/servlet/mobile#content/view/37127010

is this common kind of memory leaking bug?

Alex Snaps

unread,
Dec 3, 2015, 6:06:16 PM12/3/15
to ehcache-users
Hey,
Maybe Louis saw something I am just missing, but I see no proof of any memory leak whatsoever based on the information you provided. 
Can you share the Class definition of PlaystoreAppVO (and other classes it may use itself)? It seems each instance is 80 bytes big, based on the figures above, but would this class have any references to other Objects? Is the key type really only a String? How big are these String instances?
If I read the above correctly, you have 128 segments in that cache. What do those tables hold? You can see our datastructure here: 
net.sf.ehcache.store.chm.SelectableConcurrentHashMap.HashEntry 
So from there, mainly whatever your Element is will be the overhead. Could it be these Element.value or Element.key that's more than you expect?

--
You received this message because you are subscribed to the Google Groups "ehcache-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ehcache-user...@googlegroups.com.
To post to this group, send email to ehcach...@googlegroups.com.

no jihun

unread,
Dec 3, 2015, 7:04:13 PM12/3/15
to ehcache-users
I'm very sorry.
It seems I have confused shallow heap and retain heap.
I did wrong sizing for one PlaystoreAppVO.
facepalm..

Alex Snaps

unread,
Dec 3, 2015, 9:53:48 PM12/3/15
to ehcache-users
No worries! Glad to hear it's all ok then :)
--
You received this message because you are subscribed to the Google Groups "ehcache-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ehcache-user...@googlegroups.com.
To post to this group, send email to ehcach...@googlegroups.com.

ipsitam...@gmail.com

unread,
May 2, 2018, 2:18:52 PM5/2/18
to ehcache-users
Hi,

I am using ehcache configuration in my Spring web application.
Currently am able to see the below mentioned code consuming heaps of memory thereby causing memory leak and increasing the JVM heap. Any help is appreciated.

There is 3,326,160,944 bytes used in the heapdump and out of that 2,577,991,568 bytes (77.51 %) of Java heap is used by 64 instances of net/sf/ehcache/store/disk/Segment
Contains 64 instances of the following leak suspects:
- array of net/sf/ehcache/store/disk/HashEntry holding 39,685,064 bytes at 0x766cd5460
- array of net/sf/ehcache/store/disk/HashEntry holding 40,438,064 bytes at 0x763800090
- array of net/sf/ehcache/store/disk/HashEntry holding 41,209,560 bytes at 0x763288988
- array of net/sf/ehcache/store/disk/HashEntry holding 40,264,504 bytes at 0x7676377b8
- array of net/sf/ehcache/store/disk/HashEntry holding 40,313,656 bytes at 0x7642b8420
- array of net/sf/ehcache/store/disk/HashEntry holding 40,344,608 bytes at 0x766c00000
- array of net/sf/ehcache/store/disk/HashEntry holding 40,951,824 bytes at 0x765886ec0
- array of net/sf/ehcache/store/disk/HashEntry holding 40,331,776 bytes at 0x7631b5648
- array of net/sf/ehcache/store/disk/HashEntry holding 40,227,552 bytes at 0x766884c28
- array of net/sf/ehcache/store/disk/HashEntry holding 40,603,176 bytes at 0x76263e9d8
- array of net/sf/ehcache/store/disk/HashEntry holding 40,799,168 bytes at 0x76767dbc0
- array of net/sf/ehcache/store/disk/HashEntry holding 41,175,864 bytes at 0x765534308
- array of net/sf/ehcache/store/disk/HashEntry holding 39,993,984 bytes at 0x7661b0ba0
- array of net/sf/ehcache/store/disk/HashEntry holding 39,755,704 bytes at 0x768877580
- array of net/sf/ehcache/store/disk/HashEntry holding 40,601,240 bytes at 0x7648e0428
- array of net/sf/ehcache/store/disk/HashEntry holding 39,769,120 bytes at 0x765d73150
- array of net/sf/ehcache/store/disk/HashEntry holding 39,079,984 bytes at 0x768eaee38
- array of net/sf/ehcache/store/disk/HashEntry holding 40,737,944 bytes at 0x76852db38
- array of net/sf/ehcache/store/disk/HashEntry holding 40,486,856 bytes at 0x76287f898
- array of net/sf/ehcache/store/disk/HashEntry holding 40,398,576 bytes at 0x763acdcf0
- array of net/sf/ehcache/store/disk/HashEntry holding 39,589,184 bytes at 0x769c0cfc0
- array of net/sf/ehcache/store/disk/HashEntry holding 40,293,216 bytes at 0x764716c48
- array of net/sf/ehcache/store/disk/HashEntry holding 40,624,944 bytes at 0x766a2d298
- array of net/sf/ehcache/store/disk/HashEntry holding 39,920,072 bytes at 0x765749f38
- array of net/sf/ehcache/store/disk/HashEntry holding 39,510,208 bytes at 0x7690b5198
- array of net/sf/ehcache/store/disk/HashEntry holding 40,354,624 bytes at 0x7667efac8
- array of net/sf/ehcache/store/disk/HashEntry holding 40,327,728 bytes at 0x767022110
- array of net/sf/ehcache/store/disk/HashEntry holding 40,624,568 bytes at 0x76510b400
- array of net/sf/ehcache/store/disk/HashEntry holding 39,665,400 bytes at 0x768436998
- array of net/sf/ehcache/store/disk/HashEntry holding 40,192,816 bytes at 0x765c71708
- array of net/sf/ehcache/store/disk/HashEntry holding 40,442,400 bytes at 0x764e7c300
- array of net/sf/ehcache/store/disk/HashEntry holding 40,056,472 bytes at 0x76492d460
- array of net/sf/ehcache/store/disk/HashEntry holding 40,351,752 bytes at 0x765f495d8
- array of net/sf/ehcache/store/disk/HashEntry holding 40,609,984 bytes at 0x76562b790
- array of net/sf/ehcache/store/disk/HashEntry holding 41,034,248 bytes at 0x766158e28
- array of net/sf/ehcache/store/disk/HashEntry holding 39,366,224 bytes at 0x7648bcb88
- array of net/sf/ehcache/store/disk/HashEntry holding 40,474,552 bytes at 0x767826678
- array of net/sf/ehcache/store/disk/HashEntry holding 40,809,736 bytes at 0x766975918
- array of net/sf/ehcache/store/disk/HashEntry holding 40,379,408 bytes at 0x7664ab6d0
- array of net/sf/ehcache/store/disk/HashEntry holding 40,159,800 bytes at 0x763e472e8
- array of net/sf/ehcache/store/disk/HashEntry holding 40,236,968 bytes at 0x76685b420
- array of net/sf/ehcache/store/disk/HashEntry holding 40,132,624 bytes at 0x7672cc258
- array of net/sf/ehcache/store/disk/HashEntry holding 39,856,680 bytes at 0x76806ac60
- array of net/sf/ehcache/store/disk/HashEntry holding 40,521,752 bytes at 0x766d9b990
- array of net/sf/ehcache/store/disk/HashEntry holding 40,337,328 bytes at 0x76769a658
- array of net/sf/ehcache/store/disk/HashEntry holding 39,764,968 bytes at 0x766960e38
- array of net/sf/ehcache/store/disk/HashEntry holding 40,339,400 bytes at 0x764cab320
- array of net/sf/ehcache/store/disk/HashEntry holding 40,101,992 bytes at 0x768c05158
- array of net/sf/ehcache/store/disk/HashEntry holding 40,349,280 bytes at 0x766435ed8
- array of net/sf/ehcache/store/disk/HashEntry holding 40,640,840 bytes at 0x761d883b0
- array of net/sf/ehcache/store/disk/HashEntry holding 39,630,112 bytes at 0x767800390
- array of net/sf/ehcache/store/disk/HashEntry holding 40,094,216 bytes at 0x765a2e570
- array of net/sf/ehcache/store/disk/HashEntry holding 41,023,640 bytes at 0x76457f1a0
- array of net/sf/ehcache/store/disk/HashEntry holding 40,529,664 bytes at 0x7655505a0
- array of net/sf/ehcache/store/disk/HashEntry holding 40,478,488 bytes at 0x763dc7e00
- array of net/sf/ehcache/store/disk/HashEntry holding 40,255,616 bytes at 0x768400358
- array of net/sf/ehcache/store/disk/HashEntry holding 40,119,240 bytes at 0x7657c72e0
- array of net/sf/ehcache/store/disk/HashEntry holding 40,733,032 bytes at 0x765215388
- array of net/sf/ehcache/store/disk/HashEntry holding 39,699,752 bytes at 0x7696d8c58
- array of net/sf/ehcache/store/disk/HashEntry holding 40,563,464 bytes at 0x765a14a38
- array of net/sf/ehcache/store/disk/HashEntry holding 40,441,840 bytes at 0x7615eb638
- array of net/sf/ehcache/store/disk/HashEntry holding 40,070,144 bytes at 0x766fb9678
- array of net/sf/ehcache/store/disk/HashEntry holding 40,150,392 bytes at 0x7669ed510
- array of net/sf/ehcache/store/disk/HashEntry holding 39,953,280 bytes at 0x766008680
Total size    2,577,991,568 bytes

Name of the array of net/sf/ehcache/store/disk/Segment
Number of children    64
Number of parents    1
Owner object: net/sf/ehcache/store/disk/DiskStore

Regards,
Ipsita

Meenakshi Sharma

unread,
Aug 17, 2020, 5:45:28 AM8/17/20
to ehcache-users
Hello All,
 I wanted to know why I am getting 4 SelectableConcurrentHashp in the heap dump?
Reply all
Reply to author
Forward
0 new messages