Excessive ReentrantLock$NonfairSync objects
molsen-ee Jun 30, 2008 1:42 PMI'm using jboss-cache (jbosscache-core-2.1.1.GA) to implement a cache on a Tomcat/Apache environment and am having some issues with memory usage.
When I have the Isolation level set to anything other than "NONE" there is an excessive number of objects relating to ConcurrentHashMap's created and residing in memory. When 400k Nodes' are created there are over 7 million ConcurrentHashMap structures, approximately 16 per node. See the jmap histo dump below for the memory usage.
num #instances #bytes class name -------------------------------------- 1: 7058684 225877888 java.util.concurrent.ConcurrentHashMap$Segment 2: 7058738 169409712 java.util.concurrent.locks.ReentrantLock$NonfairSync 3: 7058684 116611080 [Ljava.util.concurrent.ConcurrentHashMap$HashEntry; 4: 443647 35648184 [Ljava.util.HashMap$Entry; 5: 441170 35293456 [Ljava.util.concurrent.ConcurrentHashMap$Segment; 6: 441115 24702440 org.jboss.cache.lock.ReadWriteLockWithUpgrade 7: 441115 21173520 org.jboss.cache.UnversionedNode 8: 443357 17734280 java.util.HashMap 9: 441170 17646800 java.util.concurrent.ConcurrentHashMap 10: 441115 17644600 org.jboss.cache.invocation.NodeInvocationDelegate 11: 455905 11396456 [Ljava.lang.Object; 12: 460983 11063592 java.util.HashMap$Entry 13: 270774 11019496 [C 14: 442649 10623576 java.util.ArrayList 15: 441377 10593048 java.util.concurrent.ConcurrentHashMap$HashEntry 16: 441142 10587408 java.util.RegularEnumSet 17: 441116 10586784 org.jboss.cache.Fqn 18: 441115 10586760 org.jboss.cache.lock.IdentityLock 19: 441117 7057872 org.jboss.cache.util.concurrent.ConcurrentHashSet 20: 441115 7057840 org.jboss.cache.lock.LockStrategyRepeatableRead 21: 441115 7057840 org.jboss.cache.lock.ReadWriteLockWithUpgrade$WriterLock 22: 441115 7057840 org.jboss.cache.lock.ReadWriteLockWithUpgrade$ReaderLock 23: 441115 7057840 org.jboss.cache.lock.LockMap
The cache is initialized and populated in a tomcat request filter when the tomcat server is first started. The cache seems to work properly but it is consuming incredible amounts of memory.