Hey Tinny and all,

It seems that I had a fundamental misunderstanding with the IDOM's
memory model. I had assumed that the memory was held by the
*Document* but it turns out that it's held by the *Parser*. That
creates a problem. A number of people using the Perl API are using the
parser to create documents and caching those documents for later use. 

The problem is that they don't care about the parser, they just want
the output DOM (IDOM in this case), so the parse the document in a
method call, and when the method ends, they return a reference to the
document. You can see the problem: the parser goes out of scope and
memory is cleaned up, and so the reference to the document is now
invalid ==> BOOM (segfault).

Is there some fundamental reason that the memory needs to be managed
by the parser? Why can't it be managed by the document?

One easy fix is to just return a reference to the parser, and cache
that, but the users don't care about the parser, just the
document. Are there some methods available via the parser that can't
be accessed through the document which make it important to keep
around the parser?

Thanks!
jas.

> Regarding the IDOMParser question from Claude, you can call 
> IDOMParser::resetDocumentPool() to release the memory.   See 
> http://xml.apache.org/xerces-c/program.html#IDOMMemImplicit for more detail.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to