RSS/Atom feed Twitter
Site is read-only, email is disabled

gimp_text_fontname and memory issues

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

2 of 2 messages available
Toggle history

Please log in to manage your subscriptions.

gimp_text_fontname and memory issues Jared Whiting 30 Aug 19:12
  gimp_text_fontname and memory issues Sven Neumann 30 Aug 20:01
Jared Whiting
2004-08-30 19:12:17 UTC (about 20 years ago)

gimp_text_fontname and memory issues

Hello-

I am working on some cgi scripts that make use of the Gimp Perl Module and Perl-Server.

So far so good, I have been able to generate images through the cgi, using the same Gimp instance.

I have noticed though that in some cases the memory for the Gimp instance continues to grow in size, even if I delete the image. For example, here's an excerpt of a test script:

Gimp::init; Gimp::lock();
Gimp::set_trace(TRACE_ALL);

my $outfile = "path to outfile... /gimp_test.gif"; my $img = gimp_image_new(300, 200, 0);

$img->gimp_image_undo_disable; my $layer = gimp_layer_new($img, 300,200,RGB, "Layer 1", 100, NORMAL_MODE); gimp_image_add_layer($img, $layer, -1); Palette->set_foreground([0, 0, 0]);

gimp_palette_set_background([255,255,255]); gimp_edit_fill($layer, BACKGROUND_FILL);

################################################### ## when these two lines are commented out ## gimp instance does not keep grabbing more memory

my $text_layer = gimp_text_fontname($img,-1,0,0,"Testing testing", 0, 0, 14, 0, "Verdana Italic");
gimp_image_merge_down($img, $text_layer, CLIP_TO_BOTTOM_LAYER);

###################################################

Gimp->perl_fu_webify($img, -1,0,0,[0, 0, 0],0,256,0); file_save($img, Gimp->-1, $outfile, $outfile);
$img->gimp_image_undo_enable;

gimp_image_delete($img);

Gimp::unlock(); Gimp::end;

I see that when I do not call the gimp_text_fontname function I don't have any noticeable memory issues regardless of how many times I call the script. My feeling is that the gimp_text_fontname is creating a resource that is not deleted with the image and that I am unable to mark for destruction (I have tried various functions for removing, attaching, deleting the layer returned by gimp_text_fontname but it does not seem to have any effect).

I am using GIMP version 2.0.1. If anyone has run into the same issues with gimp_text_fontname and has an idea of the best way to clean up resources after using it (or if I am on the wrong track here), it would be greatly appreciated.

Thanks in advance, Jared

_________

Sven Neumann
2004-08-30 20:01:39 UTC (about 20 years ago)

gimp_text_fontname and memory issues

Hi,

"Jared Whiting" writes:

I am using GIMP version 2.0.1. If anyone has run into the same issues with gimp_text_fontname and has an idea of the best way to clean up resources after using it (or if I am on the wrong track here), it would be greatly appreciated.

Please, first of all, upgrade to GIMP version 2.0.4. If the problem persists, you should definitely file a bug-report at bugzilla.gimp.org. You should also let us know what versions of freetype and pango you are using. The memory leak might be in those libraries also. It would also be good to know how much memory you see being leaked and how exactly you measure the memory usage.

If this is possible for you and if you have experience with such tools, it would be very helpful if you could run gimp and your script in a memory debugger such as memprof or valgrind. This is not necessary though, we can do that for you.

Sven