Hi,

I have a memory problem using xmlbeans for parsing XGMML files
(this is a simple xml representation of graphs, see
http://www.cs.rpi.edu/~puninj/XGMML/).

For example, I have not a very big file (45M) with XGMML.
After executing the following test code which simulates access to Id
property of graph nodes and edges:

------------------------------------------

import org.apache.xmlbeans.*;
import edu.rpi.cs.xgmml.*;
import java.io.*;

public class xgmmltest{

public static void main(String[] args) {
try{
edu.rpi.cs.xgmml.GraphDocument gr = GraphDocument.Factory.parse(new File("hs.xgmml"));
printUsedMemory();
GraphicNode arn[] = gr.getGraph().getNodeArray();
GraphicEdge are[] = gr.getGraph().getEdgeArray();
System.out.println(arn.length+" nodes, "+are.length+" edges");
for(int i=0;i<arn.length;i++){
    GraphicNode xn = arn[i];
    xn.getId();
}
System.out.print("After node call: ");  printUsedMemory();
for(int i=0;i<are.length;i++){
    GraphicEdge ed = are[i];
    ed.getId();
    //ed.getSource();
    //ed.getTarget();
}
System.out.print("After edge call: ");  printUsedMemory();
System.gc();
printUsedMemory();
}catch(Exception e){
e.printStackTrace();
}}
public static void printUsedMemory(){
   long mem =
((Runtime.getRuntime().totalMemory()-Runtime.getRuntime().freeMemory()));
   mem = (long)(1e-6f*mem);
   System.out.println("Used memory "+mem+"M");
}}

------------------------------------------

I got


Used memory 187M
14323 nodes, 63953 edges
After node call: Used memory 268M
After edge call: Used memory 880M
Used memory 880M


which is apparently too much and the garbage collection does not help.
If I uncomment access to other properties (Source and Target), I run out
1Gb.
It seems that there is a huge cache for accessing bean properties.
Is it possible to control it somehow? Clean it from time to time?

The whole test example with the xgmml file and xgmml.jar and schema
can be downloaded from
http://xfer.curie.fr/get/D3SZOoB5AWt/xgmml_test.zip
if it helps.

Thank you,
Andrei Zinovyev



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to