You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Saurabh Jain <sa...@ggn.aithent.com> on 2001/09/13 08:58:02 UTC
how to catch OutOfMemoryError in making Xml Dom
Hello list!
When i do this i am able to catch the OutOfMemoryError
static String str="a";
public static void main(String args[])
{
try
{
for(;;)
str+=str;
}
catch(java.lang.OutOfMemoryError e)
{ javax.swing.JOptionPane.showMessageDialognull,"OutOfMEmory caught");
}
}
but this doesn't happen when i go on appending child in Xmldom using Apache xerces in java.------------------
try
{
DocumentImpl docimpl=new DocumentImpl();
Element root=docimpl.createElement("root");
docimpl.appendChild(root);
doc=(Document)docimpl;
for(int i=0;;i++)
{
Element e=doc.createElement("sau"+i);
root.appendChild(e);
}
}
catch(java.lang.OutOfMemoryError e)
{
javax.swing.JOptionPane.showMessageDialognull,"OutOfMEmory caught");
}
Does Apache make a seperate thread for Dom updation or OutOfMemory is implicitly caught in the Apache-Xerces Java parser
If this isn't so then what's the reason behind this ??
Kindly update me as soon as possible
Best Wishes,
Saurabh Jain