Post

1 follower Follow
0
Avatar

Out of memory Heap Space

HI
I am running a sample code

....
cache.getRegion("transactions").put(id, tr);
....

loading from a file record and put properties in a bean, then i put in the region the id and the bean

but obviousely I get an out of memory Java heap space

how can I flush the cache, or set a size to cache .....

the xml is very simple
<cache>
<region name="people">
<region-attributes refid="REPLICATE">

</region-attributes>
</region>
</cache>

Regards

Fabio Simon

Please sign in to leave a comment.

3 comments

0
Avatar

Hi

Well that's why I wrote:

2) in the second case I get the following error:
Exception in thread "main" com.gemstone.gemfire.cache.CacheXmlException: While reading Cache XML file:/D:/workspace/TradingSystemSample/xml/Transaction.xml. Class "com.gemstone.gemfire.cache.util.ObjectSizerImpl" is not an instance of Declarable.

Notice that the tag

<class-name>com.gemstone.gemfire.cache.util.ObjectSizerImpl
</class-name>

must be a child of lru-memory-size
so the correct way is:

<lru-memory-size>
<class-name>com.gemstone.gemfire.cache.util.ObjectSizerImpl
</class-name>
</lru-memory-size>

3) the third case is Deprecated and the method parameters dont match

AttributesFactory fac = new AttributesFactory();
fac.setEvictionAttributes(EvictionAttributes.createLRUHeapAttributes(EvictionAction.LOCAL_DESTROY));

Error:
The method createLRUHeapAttributes(ObjectSizer) in the type EvictionAttributes is not applicable for the arguments

I tried with the first adding the implementation Declarable to MySizer otherwise I got an error as in 2)

My xml is
<cache>
<region name="transactions">
<region-attributes refid="REPLICATE">
<eviction-attributes>
<lru-memory-size maximum="100" action="overflow-to-disk">
<class-name>sample.MySizer</class-name>
<parameter name="name">
<string>Super Sizer</string>
</parameter>
</lru-memory-size>
</eviction-attributes>
</region-attributes>
</region>
</cache>

but after 700000 records system is veeeeeery slow.

both with overflow-to-disk and local_destroy that I still dont understand the difference

Regards

Fabio Simon 0 votes