コード例 #1
0
ファイル: init.c プロジェクト: binarytemple/debian-vips
static void
vips_leak( void ) 
{
	char txt[1024];
	VipsBuf buf = VIPS_BUF_STATIC( txt );

	vips_object_print_all();

	if( vips_tracked_get_allocs() || 
		vips_tracked_get_mem() ||
		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, "files: %d open\n",
			vips_tracked_get_files() );
	}

	vips_buf_appendf( &buf, "memory: high-water mark " );
	vips_buf_append_size( &buf, vips_tracked_get_mem_highwater() );
	vips_buf_appends( &buf, "\n" );

	fprintf( stderr, "%s", vips_buf_all( &buf ) );

	vips__type_leak();
}
コード例 #2
0
ファイル: init.c プロジェクト: ChiaraCaiazza/collageMaker
static void
vips_leak( void ) 
{
	char txt[1024];
	VipsBuf buf = VIPS_BUF_STATIC( txt );

	vips_object_print_all();

	if( vips_tracked_get_allocs() || 
		vips_tracked_get_mem() ||
		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, "files: %d open\n",
			vips_tracked_get_files() );
	}

	vips_buf_appendf( &buf, "memory: high-water mark " );
	vips_buf_append_size( &buf, vips_tracked_get_mem_highwater() );
	vips_buf_appends( &buf, "\n" );

	if( strlen( vips_error_buffer() ) > 0 ) 
		vips_buf_appendf( &buf, "error buffer: %s", 
			vips_error_buffer() );

	fprintf( stderr, "%s", vips_buf_all( &buf ) );


#ifdef DEBUG
	vips_buffer_dump_all();
#endif /*DEBUG*/
}
コード例 #3
0
ファイル: boxes.c プロジェクト: DINKIN/nip2
/* Make the insides of an about box.
 */
static void
about_build( iDialog *idlg, GtkWidget *work )
{	
	/* Translators: translate this to a credit for you, and it'll appear in
	 * the About box.
	 */
	char *translator_credits = _( "translator_credits" );

	GtkWidget *hb;
	GtkWidget *lab;
	char txt[MAX_DIALOG_TEXT];
	char txt2[MAX_DIALOG_TEXT];
	VipsBuf buf = VIPS_BUF_STATIC( txt );
	GtkWidget *image;

	im_snprintf( txt2, MAX_DIALOG_TEXT, _( "About %s." ), PACKAGE );
	vips_buf_appendf( &buf, "<b><big>%s</big></b>\n\n", txt2 );
	im_snprintf( txt2, MAX_DIALOG_TEXT, 
		_( "%s is an image processing package." ), PACKAGE );
	vips_buf_appendf( &buf, "%s\n\n", txt2 );

	im_snprintf( txt2, MAX_DIALOG_TEXT, 
		_( "%s comes with ABSOLUTELY NO WARRANTY. This is "
		"free software and you are welcome to redistribute "
		"it under certain conditions, see http://www.gnu.org." ), 
		PACKAGE );
	vips_buf_appendf( &buf, "%s\n\n", txt2 );

	im_snprintf( txt2, MAX_DIALOG_TEXT, _( NIP_COPYRIGHT ), PACKAGE );
	vips_buf_appendf( &buf, "%s\n\n", txt2 );

{
	char buf1[FILENAME_MAX];
	char buf2[FILENAME_MAX];

	im_snprintf( buf1, FILENAME_MAX, "%s" G_DIR_SEPARATOR_S "start",
		get_savedir() );
	expand_variables( buf1, buf2 );
        nativeize_path( buf2 );
	escape_markup( buf2, buf1, FILENAME_MAX );
	vips_buf_appendf( &buf, "<b>%s:</b> %s\n", 
		_( "Personal start folder" ), buf1 );
}

	vips_buf_appendf( &buf, "<b>%s:</b> %s\n", 
		_( "Homepage" ), VIPS_HOMEPAGE );
	escape_markup( im_version_string(), txt2, MAX_DIALOG_TEXT );
	vips_buf_appendf( &buf, "<b>%s:</b> %s\n", 
		_( "Linked to VIPS" ), txt2 );
	escape_markup( IM_VERSION_STRING, txt2, MAX_DIALOG_TEXT );
	vips_buf_appendf( &buf, "<b>%s:</b> %s\n", 
		_( "Built against VIPS" ), txt2 );
	escape_markup( PACKAGE, txt2, MAX_DIALOG_TEXT );
	vips_buf_appendf( &buf, "<b>$PACKAGE:</b> %s\n", txt2 );
	escape_markup( VERSION, txt2, MAX_DIALOG_TEXT );
	vips_buf_appendf( &buf, "<b>$VERSION:</b> %s\n", txt2 );
	escape_markup( NN( g_getenv( "VIPSHOME" ) ), txt2, MAX_DIALOG_TEXT );
	vips_buf_appendf( &buf, "<b>$VIPSHOME:</b> %s\n", txt2 );
	escape_markup( NN( g_getenv( "HOME" ) ), txt2, MAX_DIALOG_TEXT );
	vips_buf_appendf( &buf, "<b>$HOME:</b> %s\n", txt2 );
	escape_markup( NN( g_getenv( "SAVEDIR" ) ), txt2, MAX_DIALOG_TEXT );
	vips_buf_appendf( &buf, "<b>$SAVEDIR:</b> %s\n", txt2 );
	escape_markup( PATH_TMP, txt2, MAX_DIALOG_TEXT );
	vips_buf_appendf( &buf, "<b>%s:</b> %s\n", 
		_( "Temp files in" ), txt2 );
	if( strcmp( translator_credits, "translator_credits" ) != 0 ) {
		vips_buf_appendf( &buf, "\n" ); 
		vips_buf_appends( &buf, translator_credits );
	}

	vips_buf_appendf( &buf, "\n" ); 

	mainw_find_disc( &buf );
	/* Expands to (eg.) "14GB free in /pics/tmp" */
        vips_buf_appendf( &buf, _( " in \"%s\"" ), PATH_TMP );
        vips_buf_appends( &buf, "\n" );

        vips_buf_appendf( &buf, 
		_( "%d cells in heap, %d cells free, %d cells maximum" ),
                reduce_context->heap->ncells, 
		reduce_context->heap->nfree, 
		reduce_context->heap->max_fn( reduce_context->heap ) );
        vips_buf_appends( &buf, "\n" );

        vips_buf_appendf( &buf, _( "%d vips calls cached by nip2" ), 
		cache_history_size );
        vips_buf_appends( &buf, "\n" );

        vips_buf_appendf( &buf, _( "%d vips operations cached by libvips" ), 
		vips_cache_get_size() );
        vips_buf_appends( &buf, "\n" );

        vips_buf_appendf( &buf, _( "using %d threads" ), im_concurrency_get() );
        vips_buf_appends( &buf, "\n" );

        vips_buf_appendf( &buf, _( "%d pixel buffers in vips" ), 
		vips_tracked_get_allocs() );
        vips_buf_appends( &buf, "\n" );

	vips_buf_append_size( &buf, vips_tracked_get_mem() );
        vips_buf_appendf( &buf, _( " of ram in pixel buffers" ) ); 
        vips_buf_appends( &buf, "\n" );

	vips_buf_append_size( &buf, vips_tracked_get_mem_highwater() );
        vips_buf_appendf( &buf, _( " of ram highwater mark" ) ); 
        vips_buf_appends( &buf, "\n" );

	hb = gtk_hbox_new( FALSE, 0 );
	gtk_container_border_width( GTK_CONTAINER( hb ), 10 );
	gtk_container_add( GTK_CONTAINER( work ), hb );
	gtk_widget_show( hb );

	image = image_new_from_file( 
		"$VIPSHOME/share/$PACKAGE/data/vips-128.png" );
        gtk_box_pack_start( GTK_BOX( hb ), image, FALSE, FALSE, 2 );
	gtk_widget_show( image );

	lab = gtk_label_new( "" );
	gtk_label_set_markup( GTK_LABEL( lab ), vips_buf_all( &buf ) );
        gtk_label_set_justify( GTK_LABEL( lab ), GTK_JUSTIFY_LEFT );
        gtk_label_set_selectable( GTK_LABEL( lab ), TRUE );
	gtk_label_set_line_wrap( GTK_LABEL( lab ), TRUE );
        gtk_box_pack_start( GTK_BOX( hb ), lab, FALSE, FALSE, 2 );
	gtk_widget_show( lab );
}