Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Java heap memory error

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java heap memory error

    Hi,

    I need to process 10000 xml files and verify and insert the data into database.
    I am loading all the files in the file object and iterating one by one. I am getting the memmory issue.
    Please advise how to handle this?

    thanks
    gee


  2. #2
    Forum Squatter newbie's Avatar
    Join Date
    Nov 2010
    Location
    North Wales
    Posts
    661
    My Mood
    Stressed
    Thanks
    28
    Thanked 115 Times in 106 Posts
    Blog Entries
    1

    Default Re: Java heap memory error

    Either increase the amount of memory allocated to the heap via the JVM (see this), or ensure you read the minimal amount of data on each iteration and release all resources before proceeding with the next file. If you do not want to alter JVM settings and 1 file by itself is too large, use a SAX parser instead of a DOM parser (which I presume you're using) as SAX examines data while it parses where a DOM parser loads everything into memory before examining it.
    Please use [highlight=Java]//code goes here...[/highlight] tags when posting your code

Similar Threads

  1. Replies: 1
    Last Post: June 20th, 2013, 12:30 PM
  2. Heap Memory
    By vamsi in forum Java Theory & Questions
    Replies: 3
    Last Post: November 19th, 2011, 12:48 PM
  3. [SOLVED] Is there any way I can access heap memory faster?
    By FunkyTecknician in forum Java Theory & Questions
    Replies: 8
    Last Post: July 29th, 2011, 11:51 PM
  4. Java heap space error
    By Loki in forum What's Wrong With My Code?
    Replies: 3
    Last Post: January 27th, 2010, 10:47 PM
  5. Out of memory - Java heap space
    By fraxx in forum Java Theory & Questions
    Replies: 4
    Last Post: November 24th, 2009, 05:26 AM