Re: [gdome]Re: [Gmetadom-ocamldev] Gdome providing free()



Luca Padovani wrote:
> 
> On Sun, 2003-03-16 at 00:50, Blair Zajac wrote:
> > I'm not too certain about that, but maybe I'm missing something.
> >
> > Here's gdome_di_saveDocToMemory:
> >
> > GdomeBoolean
> > gdome_di_saveDocToMemory (GdomeDOMImplementation *self, GdomeDocument *doc,
> > char **mem, int *mem_length, GdomeSavingCode mode, GdomeException *exc)
> 
> yes you are right. So I believe this is basically the only case in the
> whole Gdome2 library where this happens, together with
> saveDocToMemoryEnv.
> 
> I'm not keen on making extensive changes in the memory management just because
> of a non-standard, isolated method. But I think there is a better way to fix
> this, for which I don't see other bad side-effects. If, instead of returning
> a char*, we make the method return a GdomeDOMString* (which has to be
> properly allocated from inside Gdome2),

I haven't looked at the GdomeDOMString code yet, so does this require a string
copy?  I'd like to minimize these.

> then GdomeDOMString will correctly
> invoke xmlFree when the last reference to it is gone. GdomeDOMString has a
> mechanism similar to that described by you, so that a hidden callback function
> is invoke upon destruction of the string (see gdome-xml-str.c for details).
> 
> What about it?

The idea sounds good, assuming we can minimize making copies.

I'll take a look at the code and put together a new patch.

Best,
Blair

-- 
Blair Zajac <blair orcaware com>
Plots of your system's performance - http://www.orcaware.com/orca/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]