This is actually 2 problems in 1.  I'm using Image::Magick and
Apache::Request/Apache::Upload to upload images to my webpage, convert them
to jpeg, and save them basically for my family to view.

Now right now I'm using TMPFS in Linux 2.4.7 for a /tmp which could be part
of my problem and I'm wondering if anyone can confirm problems with this.
It seems to work just fine except for this problem.

The problems I have is:

1).  If I upload a very large image, say a 10 meg TIFF file, Image::Magick
creates a random magic?????? file in /tmp.  This is after Apache::Upload
creates a apreq?????? file and I give the filehandle for that to
Image::Magick.  When the script is done Image::Magick doesn't delete it's
tmp file.  So that 10 meg file just sits there.  If I upload 5 at a time I
end of with 50 meg of temp files which fills my tmp dir pretty fast.

The next problem makes it even worse.

2).  Apache::Upload seams to delete it's temp file, however when I run "df"
the memory that file used is still allocated but there are no files in the
/tmp dir.  I've commented out all of the Image::Magick code in that block so
that Image::Magick never uses or accesses the file and the allocated memory
problem still exists.  So this means that I end up with 100 meg of used
space with only half that showing up as files in the dir.  I can delete all
the Image::Magick files in the dir, but that's only half of the space used.

Now I used to use a normal /tmp dir for this, and I still had the
Image::Magick problem, but I never noticed the Apache::Upload one until now.
So I don't know if this problem exists without with tmpfs.  Also if I
restart/graceful Apache it seems to release the "disk space" that it's
holding.

Below is show snippit of code similar to what I'm doing.  I cut a lot of
stuff out to show just what those two modules are doing.

Any insight or ideas about this would be very helpful.

Thank you,
Jeff Hartmann

 foreach my $file (@upload)
{

    my $i = Image::Magick->new(magick=>$type);
    $err = $i->ReadImage(file=>$$fh);
    $i->Set(magick=>$type);
    $err = $i->WriteImage(filename=>$filename));
    warn "$err" if "$err";
    undef $i;
}

Reply via email to