teqdruid
Joined: 11 May 2004 Posts: 390 Location: UMD
|
Posted: Thu Nov 02, 2006 3:25 pm Post subject: Bizzare Segfaults (a little help please) |
|
|
I've been going through my (still beta) Mango code testing it, and I'm running into a really weird issue with my SAX XML parser. For small and medium files (I tested a 4mb file) it works great. When I throw a really big file at it, it SEGVs. The really weird part is that when I throw the same file at the same program multiple times, it segvs in different places, according to GDB.
Does anybody have any idea why this might happen? I'd appreciate if some people could try this out and let me know if they can replicate the issue, and help track it down.
Here are two programs I've been using. This first one generates a large XML file:
Code: | module mango.test.genBigXml;
private import mango.io.Buffer,
mango.io.FileConduit,
mango.io.Stdout;
private import mango.text.model.UniString,
mango.text.String;
private import mango.convert.Unicode;
private import mango.xml.sax.DefaultSAXHandler,
mango.xml.sax.model.ISAXParser,
mango.xml.sax.model.ISAXHandler,
mango.xml.sax.parser.teqXML;
void main(char[][] args)
{
if (args.length != 2)
{
Stdout("Usage: "c)(args[0])(" <filename.xml>"c)(CR);
return;
}
TeqXMLWriter w = new TeqXMLWriter();
auto TextFileConduit fc = new TextFileConduit(args[1], FileStyle.ReadWriteCreate);
w.startDocument(new Buffer(fc), Unicode.UTF_8);
String me = new String("mainElement");
String e = new String("sampleElement");
String d = new String("short amount of cdata");
String k = new String("key");
String v = new String("value");
w.startElement(me);
for (int j=0; j<10000; j++)
{
for (int i=0; i<50; i++)
{
w.startElement(e);
w.characterData(d, CDataStatus.All);
}
for (int i=0; i<50; i++)
{
w.endElement(e);
}
}
for (int i=0; i<500000; i++)
{
w.startElement(e);
w.characterData(d, CDataStatus.All);
w.endElement(e);
}
w.endElement(me);
w.endDocument();
}
|
This next one is the test program I've been running:
Code: | module mango.test.timedXmlRead;
private import mango.io.Buffer,
mango.io.FileConduit,
mango.io.Stdout;
private import mango.text.model.UniString,
mango.text.String;
private import mango.convert.Type;
private import mango.xml.sax.DefaultSAXHandler,
mango.xml.sax.model.ISAXParser,
mango.xml.sax.model.ISAXHandler,
mango.xml.sax.parser.teqXML;
private import mango.sys.System;
void main(char[][] args)
{
if (args.length != 2)
{
Stdout("Usage: "c)(args[0])(" <filename.xml>"c)(CR);
return;
}
ISAXReader!() reader = new TeqXMLReader!()();
TextFileConduit file = new TextFileConduit(args[1], FileStyle.ReadExisting);
DefaultSAXHandler!() handler = new DefaultSAXHandler!()();
ulong ms = System.getMillisecs();
reader.parse(file, handler);
ulong ms2 = System.getMillisecs();
Stdout("Total time: "c)(ms2-ms)(CR);
}
|
Any help would be appreciated.
~John |
|