I use JBossCache-all-2.0.0.ALPHA2.
i have a memory leak in my application when i use JBossCache. The following test reproduce
it. It add 100 Person object to the cache, than it remove them from the cache & and
repeat...
When i use profiler, I see that the number of instances of Person is raising. (even if i
force GC).
| public void testMemoryLeak(){
| PojoCache cache =
PojoCacheFactory.createCache("com/bevents/infra/service/cache/cache.xml",
true);
| String category = "testCat";
| while (true) {
| for (int i=0 ;i<100; i++) {
| Person person = new Person();
| person.setName("aaa");
| cache.attach(category+"/testPerson"+i,person);
| assertEquals(person,cache.find(category+"/testPerson"+i));
| }
| // delete from the cache.
| cache.getCache().getRoot().removeChild(Fqn.fromString(category));
| assertNull(cache.find(category+"/testPerson0"));
| System.out.println("sleep");
| try {
| Thread.sleep(5000);
| } catch (InterruptedException e) {
| e.printStackTrace(); //To change body of catch statement use File |
Settings | File Templates.
| }
| }
| }
|
this is the configuration XML loaded for the cache:
| <?xml version="1.0" encoding="UTF-8"?>
| <server>
| <classpath codebase="./lib" archives="jboss-cache.jar,
jgroups.jar"/>
| <mbean code="org.jboss.cache.TreeCache"
| name="jboss.cache:service=TreeCache">
|
| <depends>jboss:service=Naming</depends>
| <depends>jboss:service=TransactionManager</depends>
|
| <attribute
name="TransactionManagerLookupClass">org.jboss.cache.DummyTransactionManagerLookup</attribute>
| <attribute
name="IsolationLevel">READ_COMMITTED</attribute>
|
| <attribute name="CacheMode">LOCAL</attribute>
| </mbean>
|
|
|
| </server>
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024278#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...