We help IT Professionals succeed at work.

'Out of String Space' error - How do I fix this problem?

halfondj
halfondj asked
on
Medium Priority
2,881 Views
Last Modified: 2011-10-03
I'm currently trying to debug an application written by someone else.  When parsing a large XML file, an error message displays saying 'Out of String Space'.  I found in the program a lot of dead code, as well as unused variables.  After commenting that out, the file parsing got further, but I'm still getting an 'Out of String Space' error.

Where do I go from here?  How does one debug this kind of problem?

It's quite important that I rectify this problem ASAP, as the software has to be released into production soon.

Thanks.
Comment
Watch Question

Commented:
For reference:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbenlr98/html/vamsgOutOfStrSpace.asp

Since you seem to be able to read part of the file, I am guessing that the file wasn't created in UNIX.  VB can choke when reading files with an newline character it doesn't recognize (in other words it tries to read the whole file).

Strings are messy memory hogs.  Are you parsing the XML using your own string functions or are you using the Microsoft XML tools (MSXML)?  


Author

Commented:
To dfiala13:  Thanks for the reply.  Unfortunately, the MS web page was of no help - I've seen it before.

>>  Are you parsing the XML using your own string functions or are you using the Microsoft XML tools (MSXML)?
The component object is being used - MSXML2.DOMDocument.
Commented:
OK,
You are going to need to use the SAX Parser instead.  It doesn't load the entire document into memory like the DOM, but calls events when it encounters a node and lets you handle them.  It's faster and more efficient than the DOM for large files. Need to think a little differently in your code, but it should solve your problem.

It's been a while since I've used it and it was in Java the last time I did.  But that's what you want to do.  The MSXML library has a SAX Parser object.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/htm/sax_devgd_overview_0jef.asp

If you can provide some idea what you are trying to do I could perhaps point you in the right direction.

Author

Commented:
I just started debugging the program today and haven't gotten very familiar with it, but from what I know so far, a very large XML file is read into memory via DOM and the file is parsed for specific information.  I'm not too sure with what results from parsing the file.  I think an Access database is populated and other processing occurs - what, I don't know yet.  On Monday, I will continue to review the code with my co-worker [who is more familiar with the code than I am] and will provide EE with more information.

Before Monday, I am trying to get ideas to what could be done to make the code more efficient.  Your idea of using SAX was certainly a good start.

Is it difficult to convert an application using DOM to SAX?

Thanks again.

Commented:
It shouldn't be, just a different way of thinking about the problem.  Hard to tell exactly what issues you might face without seeing the code.

Author

Commented:
We're reviewing the code now and will probably look into using SAX.

Thanks.