[rrd-developers] Memory leaks in RRDtool 1.3.x and 1.4.x?
Tobias Oetiker
tobi at oetiker.ch
Wed Aug 18 00:04:50 CEST 2010
Hi Till,
Yesterday Till Dörges wrote:
> Hello,
>
> we're currently using RRDtool for a long-running daemon. With RRDtool 1.2.x
> (currently x=30) everything is fine. :-)
>
> As soon as we try 1.3.x or 1.4.x the daemon starts leaking memory, though. The
> suspect seems to be described here:
>
> http://oss.oetiker.ch/rrdtool-trac/ticket/208
>
> Since this issue prevents us from updating, I was wondering what the current status
> of this ticket is.
hmmm pango is so twisted ... have a look at r2117 I think this
should look a lot better ... at least the 'loss' does not change
between running graph 100 or 300 times ...
I applied the patch in trunk, 1.4 and 1.3
cheers
tobi
Index: rrd_graph.c
===================================================================
--- rrd_graph.c (revision 2100)
+++ rrd_graph.c (working copy)
@@ -325,6 +325,12 @@
free(im->gdes[i].rpnp);
}
free(im->gdes);
+
+ for (i = 0; i < DIM(text_prop);i++){
+ pango_font_description_free(im->text_prop[i].font_desc);
+ im->text_prop[i].font_desc = NULL;
+ }
+
if (im->font_options)
cairo_font_options_destroy(im->font_options);
@@ -332,6 +338,8 @@
status = cairo_status(im->cr);
cairo_destroy(im->cr);
}
+
+
if (im->rendered_image) {
free(im->rendered_image);
}
@@ -3781,6 +3789,8 @@
if (font){
strncpy(im->text_prop[prop].font, font, sizeof(text_prop[prop].font) - 1);
im->text_prop[prop].font[sizeof(text_prop[prop].font) - 1] = '\0';
+ /* if we already got one, drop it first */
+ pango_font_description_free(im->text_prop[prop].font_desc);
im->text_prop[prop].font_desc = pango_font_description_from_string( font );
};
if (size > 0){
@@ -3864,6 +3874,7 @@
for (i = 0; i < DIM(text_prop); i++) {
im->text_prop[i].size = -1;
+ im->text_prop[i].font_desc = NULL;
rrd_set_font_desc(im,i, deffont ? deffont : text_prop[i].font,text_prop[i].size);
}
@@ -3878,6 +3889,7 @@
pango_cairo_update_context(im->cr,context);
im->layout = pango_layout_new(context);
+ g_object_unref (context);
// im->layout = pango_cairo_create_layout(im->cr);
--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900
More information about the rrd-developers
mailing list