Hi,
Sven Neumann wrote:
Hi,
Andrei Simion <ansi@xxxxxxxxxxxx> writes:
I have a problem with my Gimp server which runs on Linux. Every time I create an image, the memory used by the Gimp increases. I tried to delete the image at the end of the Perl subroutine that creates it, but the memory usage still goes up and is never freed. As a result, I have to restart the gimp server periodically.
If you can create a simple test case that shows the problem, we can try to help you debugging it. So far you didn't even tell us what version of GIMP you are using.
You are right. Here is the script:
#!/usr/bin/perl
use Gimp ":auto"; use Gimp::Fu;
# create a footer image
sub newimage { my ($width, $height, $texture, $color1, $color2, $blend_direction, $blend_offset) = @_;
# Create a new image $img = gimp_image_new($width, $height, RGB);
# Create a new layer
$layer = gimp_layer_new($img, 725, 125, RGB, "Layer 1", 0, NORMAL_MODE);
# define the background colors $backgroundcolor = "#0000FF"; # blue $foregroundcolor = "#FF0000"; # red gimp_palette_set_background($backgroundcolor); gimp_palette_set_foreground($foregroundcolor);
# add the layer to the image gimp_image_add_layer($img, $layer, -1);
# gimp_selection_all($img); gimp_layer_add_alpha($layer); gimp_drawable_fill($layer,BG_IMAGE_FILL); # gimp_selection_border($img, 3); #script_fu_addborder($img, $layer, 3, 3, "#000000", "100");
gimp_palette_set_background("#000000");
# define first region gimp_rect_select ($img, 0, 0, 725, 5, 2, 0, 0); # (x1, y1, x2, y2) # fill the region gimp_bucket_fill($layer,BG_BUCKET_FILL,0,100,100,0,0,0);
# define the second region gimp_rect_select ($img, 0, 120, 725, 125, 2, 0, 0); # fill the second region gimp_bucket_fill($layer,BG_BUCKET_FILL,0,100,100,0,0,0);
# define the left lateral region gimp_rect_select($img, 0, 0, 5, 125, 2, 0, 0); # fill the region gimp_bucket_fill($layer,BG_BUCKET_FILL,0,100,100,0,0,0);
# define the right lateral region gimp_rect_select($img, 720, 0, 725, 125, 2, 0, 0); # fill the region gimp_bucket_fill($layer,BG_BUCKET_FILL,0,100,100,0,0,0);
my $text = "text"; my $font = qq{-*-agenda-medium-r-normal-*-24-*-*-*-*-*-*-*}; my $text_layer = gimp_text_fontname($layer, 0, 0, $text, -1, #border 1, #antialias 48, #size 0, #size type $font );
# determine the position of the text my $texty = $height/2 - $text_layer->height/2; my $textx = $width/2 - $text_layer->width/2;
# pull out text layer we were checking size and fonts on. gimp_image_remove_layer($img,$text_layer);
# create again the layer my $text_layer = gimp_text_fontname($layer, $textx, $texty, $text, -1, #border 1, #antialias 48, #size 0, #size type $font );
gimp_floating_sel_anchor($text_layer);
# draw the border (cannot define its width) # script_fu_addborder($img, $layer, 3, 3, "#000000", "1");
#$layer2 = gimp_layer_new($img, 725, 5, RGB, "Layer 2", 0, NORMAL_MODE);
#gimp_image_add_layer($img, $layer2, -1);
#gimp_selection_all($img);
#gimp_layer_add_alpha($layer2);
#gimp_drawable_fill($layer2,FG_IMAGE_FILL);
# Set the background to the required color # gimp_palette_set_foreground($color1); # gimp_palette_set_background($color2);
# Paint the layer #gimp_edit_fill($layer, BG_IMAGE_FILL); #gimp_edit_fill($layer2, FG_IMAGE_FILL);
# delete the image gimp_image_delete($img);
# Return the image # return $img; }
register "newimage2", # fill in name "Create a footer", # a small description "for sitesell gimp project", # a help text "Andrei Simion", # Your name "", # Your copyright "2005-04-17", # Date "<Toolbox>/Xtns/Perl-Fu/Tutorial/newimage", # menu path "*", # Image types [ [PF_INT, "width", "Img width", "725"], [PF_INT, "height", "Img height", "80"], [PF_STRING,"texture", "Background Pattern", "none"], [PF_COLOR, "color1", "background color", [255,0,0]], [PF_COLOR, "color2", "Blend color", [0, 0, 255]] ], \&newimage;
exit main();
So, even though I delete the image, the swap file continues to increase.
You can solve the problem by restarting the Gimp server from time to time. But this is not an elegant way to solve the problem.
Andrei
Sven