[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Off-heap memory de-allocation  XML
Forum Index -> BigMemory
Author Message
paul13

neo

Joined: 01/25/2013 02:53:18
Messages: 5
Offline

Hi,

I've a small problem when i'm shutting down the cache manager, it does not release the memory allocated by the off-heap.
Here's my cache configuration
Code:
 <cache name="csdbCache"
 	    maxEntriesLocalHeap="100000"
 	    eternal="true"
 	    memoryStoreEvictionPolicy="FIFO"
 	    overflowToOffHeap="true"
 	    maxBytesLocalOffHeap="400M">
 </cache>
 

When the cache manager is shut down using CacheManager.getInstance().shutdown(), the memory allocated for the off-heap is not de-allocated. Then, when I want to create another cache, it's re-allocating again 400M..
The documentation says
If the JVM keeps running after you stop using BigMemory Go, you should call CacheManager.getInstance().shutdown() so that the threads are stopped and cache memory is released back to the JVM. 

Am I missing something? Does anyone facing the same problem?
Thanks in advance for your help.

Regards,


Paul
cdennis

master

Joined: 01/19/2009 10:03:26
Messages: 89
Offline

Just so I have some more information, what version of the product are you using?

One thing that immediately springs to mind is how are you validating that the offheap is not being de-allocated? If you're doing this by looking at the resident size of the process then this could be misleading. The offheap deallocation is controlled by the JVMs garbage collector so the actual release may not necessarily occur promptly. If you're seeing a genuine java reference based memory leak then that would be more concerning.

Chris Dennis (Terracotta Engineer)
paul13

neo

Joined: 01/25/2013 02:53:18
Messages: 5
Offline

Hi,

I'm using BigMemory Go with the free licence.
Code:
                 <dependency>
 			<groupId>net.sf.ehcache</groupId>
 			<artifactId>ehcache-ee</artifactId>
 			<version>2.6.3</version>
 		</dependency>
 		<dependency>
 			<groupId>org.terracotta.bigmemory</groupId>
 			<artifactId>bigmemory</artifactId>
 			<version>3.7.3</version>
 		</dependency>
 

I set -XX:MaxDirectMemorySize=600m at start.
So I had a look at the process and I thought the same first. When the cache initialize, I can observe that the process uses more ram (amount corresponds to the cache size). Then, after shutting down the cache manager, the process doesn't change and when I try to create a new cache, it does not initialize because there's not enough memory. I get the explicit error
Code:
 net.sf.ehcache.CacheException: java.lang.IllegalArgumentException: An attempt was made to allocate more off-heap memory than the JVM can allow. The limit on off-heap memory size is given by the -XX:MaxDirectMemorySize command (or equivalent).
 

I tried this morning to trigger the gc after shutting down the cache manager but no effect.. Using jconsole, i don't see anything maybe because it doesn't show the allocation but only the used memory. I'll keep looking.
Thanks for your help.

Regards,


Paul
aliana

neo

Joined: 02/03/2013 18:42:27
Messages: 1
Offline

what version of the product are you using?
[WWW]
paul13

neo

Joined: 01/25/2013 02:53:18
Messages: 5
Offline

We found the problem. We are using the cache inside a jain-slee resource adaptor.
The Slee server (Rhino), has the DisableExplicitGC turned on. So after shutting down the cache, I believe we still have references to direct buffers keeping the direct buffer alive. I believe that a System.gc is called in the cache manager shutdown method. Removing the JVM option solves the problem.
Unfortunately for us, we can't remove this option because we need to avoid stop the word collection on the Slee server to avoid performance issues. We'll look for another solution (eg overflow to disk).
 
Forum Index -> BigMemory
Go to:   
Powered by JForum 2.1.7 © JForum Team