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



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.

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...)

Jeff

On Fri, 2003-06-06 at 15:56, Ettore Perazzoli wrote:
> Hello!
> 
> There is a pretty nasty problem that our friends at Largo are having. 
> Evolution grows so much in size that they can't keep it on their
> servers.
> 
> So I told them to run memprof on it, and they kindly did that and gave
> us the results.  It looks pretty serious....
> 
> The bug is #43883 and the leak reports are at
> http://www.largo.com/ximian .
> 
> Fejj, there seems to be at least some mailer stuff in there; can you
> please have a look and start hashing out the mailer problems?  Then we
> can look at the remaining non-mailer issues.
> 
> -- Ettore
> _______________________________________________
> Gene-pool mailing list
> Gene-pool lists ximian com
> http://lists.ximian.com/mailman/listinfo/gene-pool
-- 
Jeffrey Stedfast
Evolution Hacker - Ximian, Inc.
fejj ximian com  - www.ximian.com
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/filter/ChangeLog,v
retrieving revision 1.367
diff -u -r1.367 ChangeLog
--- ChangeLog	6 May 2003 17:54:19 -0000	1.367
+++ ChangeLog	6 Jun 2003 20:49:43 -0000
@@ -1,3 +1,19 @@
+2003-06-06  Jeffrey Stedfast  <fejj ximian com>
+
+	Fixes some leaks from bug #43883.
+
+	* filter-file.c (xml_decode): Free file->path and set it to
+	NULL before entering the loop to decode it. This way if the value
+	is already set we don't leak it. Set file->path = g_strdup (str ?
+	str : ""); and then xmlFree the str.
+
+2003-05-21  Jeffrey Stedfast  <fejj ximian com>
+
+	* filter-source.c (filter_source_get_sources): Same as below.
+
+	* filter-label.c (xml_create): Unref the gconf client when we're
+	finished with it.
+
 2003-05-05  Jeffrey Stedfast  <fejj ximian com>
 
 	* filter-colour.c (format_sexp): Format the colour string in a way
Index: filter-file.c
===================================================================
RCS file: /cvs/gnome/evolution/filter/filter-file.c,v
retrieving revision 1.16
diff -u -r1.16 filter-file.c
--- filter-file.c	26 Mar 2003 20:28:54 -0000	1.16
+++ filter-file.c	6 Jun 2003 20:49:43 -0000
@@ -256,14 +256,15 @@
 	xmlFree (file->type);
 	file->type = type;
 	
+	g_free (file->path);
+	file->path = NULL;
+	
 	n = node->children;
 	while (n != NULL) {
 		if (!strcmp (n->name, type)) {
 			str = xmlNodeGetContent (n);
-			if (str)
-				file->path = g_strdup (str);
-			else
-				file->path = g_strdup ("");
+			file->path = g_strdup (str ? str : "");
+			xmlFree (str);
 			
 			d(printf ("  '%s'\n", file->path));
 			break;


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