I am using adobe flex4.6 and blazeds4.0 to communicate with server. Client makes RMI with server. Server returns an arrayList which is composed of user defined class objects. Assume 200000 objects are added in arrayList . When this arrayList is returned to the blazeds it consumed huge memory in JVM and also the memory usage for that client web browser also increased. Moreover the occupied huge memory is not garbage collected in JVM. This finally results in out of memory error as more request comes in. Below listed is a sample code for sending an arrayList to blazeds. SampleClass class has 3 variables each of type int with getters and setters.
List list = new ArrayList();
for(i=0;i<200000;i++)
{ SampleClass sampleClassObj = new SampleClass();
sampleClassObj.setId(1);
sampleClassObj.setAge(20);
sampleClassObj.setEmpId(100);
list.add(sampleClassObj);
}
return list;
Kindly reply with an immediate solution to avoid consuming huge memory in blazeds and also garbage collect that memory.