You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Colin Paul Adams <co...@colina.demon.co.uk> on 2003/06/03 16:58:26 UTC

Memory model in 2.3.0 (Was: DOM size limit?)

>>>>> "Colin" == Colin Paul Adams <co...@colina.demon.co.uk> writes:

    Colin> Is there any sort of memory constraint on the size of a
    Colin> DOMDocument, and it's collective assoicated nodes? I'm
    Colin> getting mysterious segmentation violation inside

never mind - I worked out why I'm getting these problems.

So I'll change the question.

The reason why I was getting these problems, is I am using my Eiffel
interface to Xerces-c. Now Eiffel is a garbage-collected language. 

So, in order to reclaim memory, I call the DOMDocument's release
method when the corresponding Eiffel object is reclaimed.

Unfortunately, it's not as simple as that, as the DOM consists of a
hierarchy of DOMNodes. Xerces knows all about this hierarchy, and
release triggers its way down the hierarchy freeing up the whole
memory. But if I obatin a copy of the DOMDocument (for instance, by
calling ownerDocument), then I build another Eiffel object to wrap
it. I have been able to prgram well enough not to code release twice
(I can set a flag at object creation time, to indicate the document
must be released), but it turns out that this is not sufficient. 

Because I can then get a DOMElement from a DOMDocument, and I cannot
necessarily maintain a reference to the correct Eiffel wrapper object
for the DOMDocument (I might have obtained the DOMElement from a copy
of the document via ownerDocument, for instance). As a result, I can
attempt to reference an element that has had it's memory reclaimed.
I can see no way around this problem.

I'm wondering if the new user-managed memory in 2.3.0 might be of use
to me. Is there a good write-up on the subject somewhere?
-- 
Colin Paul Adams
Preston Lancashire

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org