Stephan van Hulst wrote:You are probably allocating a lot of objects in a long (possibly infinite) loop, or you have a memory leak somewhere (e.g. storing object references in a list and forgetting to null them out when you're done with them).
Hi,
i am also getting outofmemoryerror :java heap space
can you please help me out in fixing this error.
code:
public static Vector multiplyVectors(Vector vect1,Vector vect2){
Vector resultVector=new Vector();
for(int i=0;i<vect1.size();i++){
for(int j=0;j<vect2.size();j++){
vector v=new Vector();
v.addAll((Vector)vect1.elementAt(i));
v.addAll((Vector)vect2.elementAt(j));
resultVect.add(v);
}
}
}
in the above program, both vector sizes reaches to more than 5000 causes outofmemoryerror.
Thanks for help in advance.>