Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

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
Bartender
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
Rancher
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!