Anyone who wants to jump in and correct me, please do so.

Xerces tries to use reference counting wherever possible to
automatically dispose of unused memory in much the same way that Java
does it.  If you actually use new and delete, then the built-in garbage
collection won't work because the reference counting will be wrong.

As a side note, has anyone considered overriding new and delete to
permanently solve this problem?

Cem

Konstantin Kivi wrote:
> 
>  From the xerces docs:
> >Key points to remember when using the C++ DOM classes:
> >   Create them as local variables, or as member
> >   variables of some other class.   Never "new" a
> >   DOM object into the heap or make an ordinary C
> >   pointer variable to one, as this will greatly
> >   confuse the automatic memory management.
> 
> Why can't I 'new' dom objects? Is this wrong practise
> unconditionally, or I only must be very careful?
> 
> what is the difference between
> 
> {
>         DOM_Document *pdoc=new
>                 DOM_Document(impl.createDocument(...));
> 
> ...........................
>         delete pdoc;
> }
> 
> and
> {
>         DOM_Document doc=impl.createDoc(...);
> ......................
> 
> }
> 
> why I can make those objects being parts of the
> stucture and then alloc the that structure?
> (the doc doesn't say I can't do so)
> 
> What I exactly need is to pass the pointer
> to DOM_Document or its equivalent (call it handle)
> between C and C++ parts of the programm.
> 
> Sorry if I am asking something really stupid
> 
> --
> Sincerely Yours, Konstantin Kivi, Russia, [EMAIL PROTECTED]

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

Reply via email to