possible memleak with pangoft2?
- From: John Cupitt <jcupitt gmail com>
- To: gtk-list <gtk-list gnome org>
- Subject: possible memleak with pangoft2?
- Date: Fri, 8 Apr 2005 14:51:20 +0100
Hi all,
I'm having problems plugging a memleak in a program using pangoft2.
This program seems to leak about 250kbytes per loop on my system. Am I
doing something stupid, or should I add to bugzilla?
This is pango-1.8.1, freetype 2.1.4
John
------------ snip ---------------
/*
compile with:
gcc -g -Wall `pkg-config pango pangoft2 --cflags --libs` texttest.c
*/
#include <pango/pango.h>
#include <pango/pangoft2.h>
static void
test( const char *text, const char *font )
{
PangoFontMap *fontmap;
PangoContext *context;
PangoLayout *layout;
PangoFontDescription *font_description;
PangoRectangle logical_rect;
fontmap = pango_ft2_font_map_new();
context = pango_ft2_font_map_create_context(
PANGO_FT2_FONT_MAP( fontmap ) );
layout = pango_layout_new( context );
font_description = pango_font_description_from_string( font );
pango_layout_set_font_description( layout, font_description );
pango_font_description_free( font_description );
pango_layout_set_markup( layout, text, -1 );
/* Comment this line out and the leak stops.
*/
pango_layout_get_extents( layout, NULL, &logical_rect );
g_object_unref( layout );
g_object_unref( context );
g_object_unref( fontmap );
}
int
main( int argc, char *argv[] )
{
int i;
test( "AAA0001234", "courier 12" );
/* At this point, RSS == 2616
*/
getchar();
for( i = 0; i < 1000; i++ )
test( "AAA0001234", "courier 12" );
/* At this point, RSS == 253236, so we leak about 250k per
* pango_layout_get_extents().
*/
getchar();
return( 0 );
}
--------------------------- snip ---------------------------
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]