[evolution-patches] Re: [gene-pool] 1.4.0 memory leaks - FIX (for mailer)



On Sat, 2003-06-07 at 06:41, Jeffrey Stedfast wrote:
> Attached is a patch that fixes all the mailer leaks that were reported
> in that log file (afaict).
> 
> NotZed: btw, I wonder if we should stick with g_strdup/g_free instead of
> mixing libxml and glib apis? You'll notice that at least
> filter-element.c uses libxml's strdup/free functions exclusively. While
> filter-file.c uses glib's for file->path but for file->type, we use
> libxml's. We also change fe->name in xml_decode() which is from
> filter-element which uses libxml's api.

libxml (well actually glib) make it uglier than it needs to be ...

someone went through and 'fixed' things up at some point and made more
of a mess of it than was there, although most of those got fixed
eventually (my gmalloc != xmlmalloc or malloc, so i pick up mixed calls
easily).

i guess i dont really care too much, but its a pita either way

> Just makes things uglier than they need to be... at the same time, it
> sucks having to do:
> 
> str = xmlGetFooString();
> f->str = g_strdup (str);
> xmlFree (str);
> 
> (altho... for xmlNodeGetContent(), libxml seems to use a minimal buffer
> size of 4000 bytes, hence the massive leaks he's getting so quickly...)

groan, thats nice to know.

not that using gstrings is really much better anyway, you can waste lots
of space if you dont strdup the result (on average, around 2x the string
size).

The patch looks ok





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