java.lang.OutOfMemoryError - Please Help-

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • novel

    java.lang.OutOfMemoryError - Please Help-

    Hi,

    i wrote a java program, that create a rdf file parsing a file tree.
    On the last step the shockwaves and gifs are checked and the byte
    sizes are written in the rdf file as nodes.

    The 1. Problem: A java.lang.OutOf MemoryError is throwm. Sometimes on
    the 45 shockwave, sometimes on the 53 shockwave...


    code:

    for(int i = 0; i < objects.getLeng th(); i++){
    String xValue = "concat(./dir/text(), ./objects/object/param[@name
    =
    'movie']/@value)";
    // XPath Ausdruck anwenden
    XObject xO = XPathAPI.eval(o bjects.item(i), xValue);
    // the shockwave
    f = new File(xO.toStrin g());
    // byte size
    long size = f.length();
    String x = "/*/Description[contains(@about , '" + f.getPath() +
    "')]";
    nodes = XPathAPI.select NodeList(root, x.replace('\\', '/'));
    if(nodes.getLen gth() == 1){
    Node extent = target.createEl ement("dcterms: extent");
    Node bytesize = target.createEl ement("lom-tech:ByteSize") ;
    Node value = target.createEl ement("rdf:valu e");
    Node length = target.createTe xtNode("" + size);
    value.appendChi ld(length);
    bytesize.append Child(value);
    extent.appendCh ild(bytesize);
    nodes.item(0).a ppendChild(exte nt);
    }
    }

    the 2. Problem.

    After parsing the shockwaves i want to scall down images in the file
    tree and save it. After this i want to add the new image url as node
    to the rdf tree.

    the same Exception!!!!



    Thanks and greetings

    novel
  • Raymond DeCampo

    #2
    Re: java.lang.OutOf MemoryError - Please Help-

    novel wrote:[color=blue]
    > Hi,
    >
    > i wrote a java program, that create a rdf file parsing a file tree.
    > On the last step the shockwaves and gifs are checked and the byte
    > sizes are written in the rdf file as nodes.
    >
    > The 1. Problem: A java.lang.OutOf MemoryError is throwm. Sometimes on
    > the 45 shockwave, sometimes on the 53 shockwave...[/color]

    You have two options:

    1) Use the -Xmx option to the java executable to increase the available
    memory to the java process. (See the SDK tool documentation for details.)

    2) Re-write your algorithms to use less memory.

    Please, no side wagers on which one the OP will use :)

    Ray

    Comment

    Working...