From bfeeb3eb27907b2a296c4e870683e24bfb9c54ba Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 1 May 2015 16:42:23 +0100 Subject: [PATCH] better leak reporting Vips::print_all now shows VipsArea leaks as well --- ChangeLog | 1 + libvips/iofuncs/init.c | 2 -- libvips/iofuncs/object.c | 2 ++ libvips/iofuncs/type.c | 7 ++++--- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3c317bcf..dd1ace0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ - fix some compiler warnings - work around a glib bug that can cause segv under load - add some notes on threading to the docs +- better leak reporting 11/2/15 started 8.0 - remove old doc stuff, lots of doc improvements diff --git a/libvips/iofuncs/init.c b/libvips/iofuncs/init.c index 7f760d5e..c7780bf8 100644 --- a/libvips/iofuncs/init.c +++ b/libvips/iofuncs/init.c @@ -451,8 +451,6 @@ vips_leak( void ) fprintf( stderr, "%s", vips_buf_all( &buf ) ); - vips__type_leak(); - #ifdef DEBUG vips_buffer_dump_all(); #endif /*DEBUG*/ diff --git a/libvips/iofuncs/object.c b/libvips/iofuncs/object.c index 1adc3534..30f0b813 100644 --- a/libvips/iofuncs/object.c +++ b/libvips/iofuncs/object.c @@ -2949,6 +2949,8 @@ vips_object_print_all( void ) vips_object_map( (VipsSListMap2Fn) vips_object_print_all_cb, &n, NULL ); } + + vips__type_leak(); } static void * diff --git a/libvips/iofuncs/type.c b/libvips/iofuncs/type.c index 4a2a2032..4f0aab8b 100644 --- a/libvips/iofuncs/type.c +++ b/libvips/iofuncs/type.c @@ -273,13 +273,14 @@ vips__type_leak( void ) if( vips_area_all ) { GSList *p; - printf( "VipsArea leaks:\n" ); + fprintf( stderr, "%d VipsArea alive\n", + g_slist_length( vips_area_all ) ); for( p = vips_area_all; p; p = p->next ) { VipsArea *area = (VipsArea *) p->data; - printf( "\t%p count = %d\n", area, area->count ); + fprintf( stderr, "\t%p count = %d, bytes = %zd\n", + area, area->count, area->length ); } - printf( "%d in total\n", g_slist_length( vips_area_all ) ); } }