This week's book giveaway is in the XML and Related Technologies forum.
We're giving away four copies of Java XML & JSON and have Jeff Friesen on-line!
See this thread for details.
Win a copy of Java XML & JSON this week in the XML and Related Technologies forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

OutOfMemoryError - no stack trace available  RSS feed

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am executing a program that parses some XML files and stores the extracted data into a database. There are many files with size ranging from 1.72 KB to 6.5 MB. When I am parsing the files using DOMParser, the program executes successfully. It parses some files and then terminates its execution by giving the following output:

java.lang.OutOfMemoryError
<<no stack trace available>>


When I re-execute the program and start from the file which was last processed in the previous execution, the program runs successfully. Can anyone help me out in finding what the problem is? Also, will SAX processing speed up the program execution and avoid such errors from getting thrown?
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Ketan Chachad:
Also, will SAX processing speed up the program execution and avoid such errors from getting thrown?


I would say its better if you use SAX as your xml file may vary from 1kb to 6.5MB and also you are only retrieving the data and not changing any data in the XML file., this should increase the processing speed with less memory consumption.
 
Ketan KC Chachad
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Balaji for the suggestion and SAX is working perfectly fine. But is the OutOfMemoryError because the system I am currently working on has low memory? I mean will increasing the memory capacity allow me to use DOMParser?
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A DOM parser builds a huge structure in memory with objects for everything in your XML file. Since all the text becomes String objects using 16 bits per character and there is all the overhead required for other parts of the structure, you are talking a huge memory requirement.
So, the answer is yes, increasing the Java memory allocation will let you handle larger documents with DOM.
Bill
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!