-
1. Re: I have memory problem with Infinispan
nhutnguyenhong Oct 11, 2010 12:01 AM (in response to nhutnguyenhong)So this is my test code:
public static void main(String... s) throws Exception {
EmbeddedCacheManager manager = new DefaultCacheManager();
Cache<Integer,User> cache = manager.getCache();
List<Long> listFriend = new ArrayList<Long>();
for (int k = 0; k < 100; k++) {
listFriend.add(new Long(k));
}
for (int i = 0; i < 100000; i++) {
User u = new User(i, "helo woels dsf jlsdjkf klsd jlkdsfj kldskdlsf jdkls jlds fjkldsfjdklfsjklds jkl lkdjfl");
u.setFriends(listFriend);
cache.put(i, u);
}
System.out.println("set cache ok");
for(int h=0;h<5;h++){
for (int i = 0; i < 100000; i++) {
System.out.println(cache.get(i));
}
}
System.in.read();
} -
2. Re: I have memory problem with Infinispan
mircea.markus Oct 11, 2010 4:27 AM (in response to nhutnguyenhong)Hi Nhut,
On reading additional objects are being created on reading objects from the cache: thats's just part of Infinsipan's internals e.g. they have to do with supporting different isolation levels etc. These object should be collected by the GC though. What map do you use for caching? Seems like infinsipan's memory usage is better.
-
3. Re: I have memory problem with Infinispan
nhutnguyenhong Oct 11, 2010 6:01 AM (in response to mircea.markus)Thank Markus,
I think it is all with GC.because after I take all items, the memory used be decreased.My Current Map I used is com.reardencommerce.kernel.collections.shared.evictable.ConcurrentLinkedHashMap, It work OK but take more memory( although I serializer Object to byte arrays).
Thanks for your helpful.