CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    May 2011
    Posts
    3

    Maximum Heap Size?

    I have an application which processes large XML files that is very memory-intensive. In order to get the app to run, I've been tweaking the -Xmx and -Xms options that I pass to javaw.exe. I've found that any value greater than -Xmx1500M causes the JVM launcher to spit an error at me reading "Could not create the Java virtual machine". Is there a way I can continue to increase the maximum heap size? Is there some sort of hard-coded limit that I'm hitting?

    The machine I'm using for this is running Windows 7 64-bit and has 24GB of RAM, so I'm confused as to why I can't allocate more memory to the heap.

    Thanks in advance!

  2. #2
    Join Date
    Feb 2008
    Posts
    966

    Re: Maximum Heap Size?

    I think you need to look at how you are processing the XML instead of how to increase the heap size. There are several different ways to process XML in Java, one of which is buffered so that you can process large files.

    Can you post a small portion of your code and show how you are parsing it so that we may help?

  3. #3
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: Maximum Heap Size?

    Sequential processing using SAX is generally the preferred method for processing large XML files, as DOM tries to load the whole file for random access - however, the choice does also depend on the processing requirements.

    Premature optimization is the root of all evil in programming...
    C.A.R. Hoare
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  4. #4
    Join Date
    May 2011
    Posts
    3

    Re: Maximum Heap Size?

    Right, there could be ways I can make the xml processing more efficient. However, I do not have access to the code base. This is a standalone static analysis tool provided by a third-party, so I cannot modify the code.

  5. #5
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: Maximum Heap Size?

    Have you tried setting true binary block sizes, like -Xmx2048M or -Xmx2G ?

    I haven't tried such large heap allocations, but I have sometimes found the JVM sensitive to the block size...

    Alternatively, it might be worth checking whether the OS has default settings to limit process memory allocation - it might be that it needs adjusting.

    Less is more...
    M. van der Rohe
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  6. #6
    Join Date
    May 2011
    Posts
    3

    Re: Maximum Heap Size?

    No, I haven't tried true binary block sizes. I suppose that's worth a shot. I doubt that the OS is limiting the process's memory allocation, since I'm able to run other applications (non java based) that use up to 15GB of RAM.

    I would expect that most people haven't had much experience with such large heap sizes

    Thanks for the advice!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured