Does anyone see anything wrong here?
From: Stan Brown (stanb_at_panix.com)
Date: 11/19/03
- Next message: Marwan Hamid Zaif: "Re: kathy, power of his own PR"
- Previous message: A. Lewenberg: "DBD::Sybase 1.01 and transactions"
- Next in thread: peter pilsl: "Re: Does anyone see anything wrong here?"
- Reply: peter pilsl: "Re: Does anyone see anything wrong here?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 18 Nov 2003 23:11:16 +0000 (UTC)
I've got a long running perl script that leaks emeory like teh Ttitanix.
With sme help from the perl.misc news group, I've tracked the leak down to
this subroutine, which I largely lifted from a webcam perl script I found
in the Debain archive.
Does anyone see anything wrong with this?
##################################################################
#
# reads in temporary capture file adds timestamp, and writes
# it to the permanent location
#
# Argument 1 is filename that the labled image should be stored as
#
# Argument 2 is the label to apply
#
# Argument 3 is the filename that the image is curently in
#
# Argument 4 is the color to label the image with
#
# Argument 5 is the font size to use for the label
#
###################################################################
my $final_filename = $_[0];
my $l_tstamp = $_[1];
my $l_tmpfile = $_[2];
my $l_lbl_color = $_[3];
my $l_lbl_size = $_[4];
my $image = Image::Magick->new(magick=>'GIF',font=>'clean');
my $function_name = (caller(0))[3];
my $argtmp = join ', ', map "Arg$_ " .
( defined $_[$_] ? "->$_[$_]<-" :
'*UNDEF*'), 0 .. $#_;
print_debug(2,"Entering $function_name()\n",0,0);
print_debug(3,"$argtmp\n",0,0);
$image->Read($l_tmpfile);
#On ajoute le text
$image->Annotate(fill=>'white',
pointsize=>$l_lbl_size,
text=>$l_tstamp,
gravity=>'SouthWest',
stroke=>$l_lbl_color,
fill=>'black',
y=>(int($l_lbl_size * 1.4)));
#On écrit le fichier
$image->Write($final_filename);
print_debug(3,"Returning from $function_name()\n",0,0);
}
-- "They that would give up essential liberty for temporary safety deserve neither liberty nor safety." -- Benjamin Franklin
- Next message: Marwan Hamid Zaif: "Re: kathy, power of his own PR"
- Previous message: A. Lewenberg: "DBD::Sybase 1.01 and transactions"
- Next in thread: peter pilsl: "Re: Does anyone see anything wrong here?"
- Reply: peter pilsl: "Re: Does anyone see anything wrong here?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]