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
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.
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
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