OutOf Memory exception under Eclipse when using relatively small amount of heap

Discussion in 'Java' started by lennyw@comcast.net, May 24, 2006.

  1. Guest

    Hi

    I've tried an experimental app under Eclipse, that parses / transforms
    a large (96Mb) xml file using the java XSLT library DOM parser and
    then tried the SAX parser. The program runs fine with smaller XML
    input files but exits with OutOfMemory with the large input file.

    It seemed odd to me that I would get an out of memory because I'm set
    up with quite a bit of physical memory.
    My setup is:

    WinXP Pro
    768 Mb Ram
    Eclipse -vmargs -Xmx1628M (biggest I can set it for, and still have it
    load)
    jvm 1.4.2_11
    WinXP Virtual memory setup: Min 1149Mb Max 4095 (also tried "Let system
    manage virtual memory")

    It's a not heavily loaded desktop computer running little more than the
    OS, an antivirus program and Eclipse.

    To get a better idea of what's going on, I tried making a simple heap
    test program
    (below),which allocates in units of 1,0000,000 bytes until it crashes.
    It consistently crashes with the array index i = 32. I find the value
    32
    to be a little suspicious, but looking through the various properties
    of the test programs "project" parameters in Eclipse, I don't find any
    limitations.

    Can you give me some specific things to try or a general strategy I can
    use
    to isolate the cause of this problem?

    Thanks in advance for any help.

    Lenny Wintfeld

    ps - here's the test program

    public class TestHeapOverflow {

    public static void main(String[] args) {
    char [] [] arrayArray = new char[2000][];
    int i = 0;
    try {
    for (i = 0; i<2000; i++)
    {
    arrayArray = new char[1000000];
    }
    } catch (RuntimeException e) {
    e.printStackTrace();
    }
    finally{System.out.println("i="+i);}
    }

    }
    , May 24, 2006
    #1
    1. Advertising

  2. Oliver Wong Guest

    <> wrote in message
    news:...
    > Hi
    >
    > I've tried an experimental app under Eclipse, that parses / transforms
    > a large (96Mb) xml file using the java XSLT library DOM parser and
    > then tried the SAX parser. The program runs fine with smaller XML
    > input files but exits with OutOfMemory with the large input file.
    >
    > It seemed odd to me that I would get an out of memory because I'm set
    > up with quite a bit of physical memory.
    > My setup is:
    >
    > WinXP Pro
    > 768 Mb Ram
    > Eclipse -vmargs -Xmx1628M (biggest I can set it for, and still have it
    > load)


    This "experimental app"; is it a plugin to Eclipse? If not, then you've
    given Eclipse 1628MB of RAM, but not the app. The app runs in a seperate VM,
    and is allocated memory seperately. In the run-configuration for the app,
    add -Xmx128M or something like that to the "VM Arguments" section.

    - Oliver
    Oliver Wong, May 24, 2006
    #2
    1. Advertising

  3. Guest

    Wow thanks! I thought the Xmx in the -vmargs was for the vm that runs
    the app. Your suggestion worked out great.

    Lenny Wintfeld
    , May 24, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jose luis fernandez diaz

    Amount of heap memory reserved by a procces

    jose luis fernandez diaz, Feb 9, 2004, in forum: C++
    Replies:
    2
    Views:
    379
    Michael Groys
    Feb 9, 2004
  2. Replies:
    2
    Views:
    1,806
  3. Replies:
    1
    Views:
    123
  4. contact2rr
    Replies:
    0
    Views:
    319
    contact2rr
    Nov 17, 2011
  5. Gennady Bystritsky
    Replies:
    4
    Views:
    408
    Gennady Bystritsky
    Jul 27, 2009
Loading...

Share This Page