only pront a leak message if there's a leak

This commit is contained in:
John Cupitt 2011-11-14 08:51:09 +00:00
parent a31c7d8caf
commit c5c2cf5f2b

View File

@ -295,14 +295,19 @@ vips_leak( void )
vips_object_print_all();
vips_buf_appendf( &buf, "memory: %d allocations, %zd bytes\n",
vips_tracked_get_allocs(), vips_tracked_get_mem() );
vips_buf_appendf( &buf, "memory: high-water mark " );
vips_buf_append_size( &buf, vips_tracked_get_mem_highwater() );
vips_buf_appendf( &buf, "\nfiles: %d open\n",
vips_tracked_get_files() );
if( vips_tracked_get_allocs() ||
vips_tracked_get_mem() ||
vips_tracked_get_mem_highwater() ||
vips_tracked_get_files() ) {
vips_buf_appendf( &buf, "memory: %d allocations, %zd bytes\n",
vips_tracked_get_allocs(), vips_tracked_get_mem() );
vips_buf_appendf( &buf, "memory: high-water mark " );
vips_buf_append_size( &buf, vips_tracked_get_mem_highwater() );
vips_buf_appendf( &buf, "\nfiles: %d open\n",
vips_tracked_get_files() );
fprintf( stderr, "%s", vips_buf_all( &buf ) );
fprintf( stderr, "%s", vips_buf_all( &buf ) );
}
}
/**