E
Eric Lo
Hello all,
I seldom post such long message, but I really tired on keep fighting
with this thing and I thus ask your help here.
My program loads a pretty big data structure from disk.
On the disk, the file is "843,142bytes 10000c_UNI.rcs"
Since I get stuck into this out-of-memory error problem for a long
time, I have tried to use many profiling solutions:
1) Added runtime.memory statements:
public static void main(String args[]) {
tuning("b4 loading the conflict set:");
String fileName = "10000c_UNI";
ConflictTree rcs= (ConflictTree)
readObjectFromFile(fileName+".rcs");
System.out.println("Real Conflict Set loaded from
"+fileName+".rcs");
tuning("after loading the conflict set:");
}
public static void tuning(String msg){
System.err.println(msg);
System.err.println("Memory: curr total for JVM=" + r.totalMemory());
System.err.println("Memory: free=" + r.freeMemory());
System.err.println("Memory: in used=" + (r.totalMemory() -
r.freeMemory()));
System.err.println("Memory: JVM max heap=" + r.maxMemory());
}
===output===
b4 loading the conflict set:
Memory: curr total for JVM=2031616
Memory: free=1265136
Memory: in used=766824
Memory: JVM max heap=66650112
Real Conflict Set loaded from 10000c_UNI.rcs
after loading the conflict set:
Memory: curr total for JVM=6451200
Memory: free=7296
Memory: in used=6444248
Memory: JVM max heap=66650112
JProfiler> Keeping VM alive until frontend disconnects.
============
By looking at the verbose output, I first guess the data structure
ConflictTree has some problems: it used up 6444248-766824= 5M of
memory. However, it takes only on 834K on disk (I understand that the
serialized object usually is bigger than the object in memory).
However, I found no obvious memory leak problem on the
ConflictTree.java.
Therefore, I try to use JProfiler3:
2) Use Jprofiler 3 (evaluation version) to track where is the memory
gone:
Interestingly, from JProfiler (the first number is the number of
instance, the second number is the number of memory used in bytes),
the conflictTree and its component (TreeEdge) used up ~240K only, and
exactly 10001 objects (same as my input):
---------
<class>[ ] 47,768 2,921,384
char[ ] 20,497 681,616
java.util.ArrayList 22,673 544,152
java.lang.Integer 20,000 320,000
java.lang.String 13,219 317,256
java.util.HashMap$Entry 12,816 307,584
regtest.conflictManagement.TreeEdge 10,001 240,024
byte[ ] 229 165,472
java.lang.StringBuffer 7,253 116,048
short[ ] 338 21,080
java.lang.Class 232 20,416
.....
regtest.conflictManagement.ConflictTree 1 32
---------
I found there is a strange <class>[] used up 2M memory by 47768
instances.
Up to this point, I get lost:
(1) Either the <class>[] is referred to an array of a class member of
TreeEdge; The signature for TreeEdge is:
private Object trace;
private ArrayList data = new ArrayList();
private HashMap children;
private TreeEdge parent;
or
(2) There is something else called <class>[]?
*********************
In fact, this is just a testing program that I extracted from a very
large program. That original program always throw out-of-memory even
though I set the heap size to near 2G (where I run on a 4G 32 bit
server) when it continues to run and add more TreeEdges to the
ConflictTree.
Thanks a lot of reading this message!
Cheer and thanks!
Eric
I seldom post such long message, but I really tired on keep fighting
with this thing and I thus ask your help here.
My program loads a pretty big data structure from disk.
On the disk, the file is "843,142bytes 10000c_UNI.rcs"
Since I get stuck into this out-of-memory error problem for a long
time, I have tried to use many profiling solutions:
1) Added runtime.memory statements:
public static void main(String args[]) {
tuning("b4 loading the conflict set:");
String fileName = "10000c_UNI";
ConflictTree rcs= (ConflictTree)
readObjectFromFile(fileName+".rcs");
System.out.println("Real Conflict Set loaded from
"+fileName+".rcs");
tuning("after loading the conflict set:");
}
public static void tuning(String msg){
System.err.println(msg);
System.err.println("Memory: curr total for JVM=" + r.totalMemory());
System.err.println("Memory: free=" + r.freeMemory());
System.err.println("Memory: in used=" + (r.totalMemory() -
r.freeMemory()));
System.err.println("Memory: JVM max heap=" + r.maxMemory());
}
===output===
b4 loading the conflict set:
Memory: curr total for JVM=2031616
Memory: free=1265136
Memory: in used=766824
Memory: JVM max heap=66650112
Real Conflict Set loaded from 10000c_UNI.rcs
after loading the conflict set:
Memory: curr total for JVM=6451200
Memory: free=7296
Memory: in used=6444248
Memory: JVM max heap=66650112
JProfiler> Keeping VM alive until frontend disconnects.
============
By looking at the verbose output, I first guess the data structure
ConflictTree has some problems: it used up 6444248-766824= 5M of
memory. However, it takes only on 834K on disk (I understand that the
serialized object usually is bigger than the object in memory).
However, I found no obvious memory leak problem on the
ConflictTree.java.
Therefore, I try to use JProfiler3:
2) Use Jprofiler 3 (evaluation version) to track where is the memory
gone:
Interestingly, from JProfiler (the first number is the number of
instance, the second number is the number of memory used in bytes),
the conflictTree and its component (TreeEdge) used up ~240K only, and
exactly 10001 objects (same as my input):
---------
<class>[ ] 47,768 2,921,384
char[ ] 20,497 681,616
java.util.ArrayList 22,673 544,152
java.lang.Integer 20,000 320,000
java.lang.String 13,219 317,256
java.util.HashMap$Entry 12,816 307,584
regtest.conflictManagement.TreeEdge 10,001 240,024
byte[ ] 229 165,472
java.lang.StringBuffer 7,253 116,048
short[ ] 338 21,080
java.lang.Class 232 20,416
.....
regtest.conflictManagement.ConflictTree 1 32
---------
I found there is a strange <class>[] used up 2M memory by 47768
instances.
Up to this point, I get lost:
(1) Either the <class>[] is referred to an array of a class member of
TreeEdge; The signature for TreeEdge is:
private Object trace;
private ArrayList data = new ArrayList();
private HashMap children;
private TreeEdge parent;
or
(2) There is something else called <class>[]?
*********************
In fact, this is just a testing program that I extracted from a very
large program. That original program always throw out-of-memory even
though I set the heap size to near 2G (where I run on a 4G 32 bit
server) when it continues to run and add more TreeEdges to the
ConflictTree.
Thanks a lot of reading this message!
Cheer and thanks!
Eric