java - blazesds consuming huge memory -
blazeds 4 used communicate flex4.6. when flex client invokes remote phone call on blazeds server, server returns arraylist containing pojos. assuming each pojo mem size 12 bytes, expecting arraylist size 12*number of elements. however, find somewhere in blazeds, compounded multiple times. assuming add together 200000 pojos array list, expecting size ~2mb. but, see through profilers, jvm shoots n times of original size , same n times mem beingness transfered flex browser application also. below listed sample code demonstrates problem, jmap profiler captures. happy provide flex code if needed.
list list = new arraylist(); for(i=0;i<200000;i++) { sampleclass sampleclassobj = new sampleclass(); sampleclassobj.setid(1); sampleclassobj.setage(20); list.add(sampleclassobj); } homecoming list;
and sampleclass class definition follows
public class sampleclass { long id; int age; // getters , setters each variables }
memory profiled in jmap.exe resides in jdk path. intitail memory in jvm before recieving request client ~50mb. output jmap before request client.
num #instances #bytes class name 1 63135 8497488 constmethodklass 2 65671 7858440 [c 3 91344 5217976 symbolklass . . total 658429 50097416 //initial memory in jvm
the output jmap after processing request.
num #instances #bytes class name 1 11402 20225512 [b 2 200000 1948809 sampleclass //as expected ~2mb 3 62734 8451040 constmethodklass . . total 1175132 93938272 //consumed memory in jvm not garbage collected.
strange enough, when seek invoke same method flex repeatedly, jvm memory not correspondingly increase. first time multifold increment seen in jvm. however, flex client application memory keeps increasing every call.
i tried running same on yourkit profiler , tried invoking gc multiple times in vain.
can please create me understand going on within blazeds.
in default arraylist
capacity 10 objects, after adding new object if current capacity over, list increment self capacity in 50% of current capacity. maybe reason of memory liks. seek read docs http://docs.oracle.com/javase/6/docs/api/java/util/arraylist.html
java flex memory-leaks blazeds jmap
No comments:
Post a Comment