Subject: | Potential memory leak in Image::ExifTool |
Image::ExifTool 9.01, perl, v5.8.8 built for x86_64-linux-thread-multi
Linux pluto 2.6.18-164.6.1.el5xen #1 SMP Tue Nov 3 16:48:13 EST 2009
x86_64 x86_64 x86_64 GNU/Linux
While trying to track down a memory leak in a long running perl program
that uses Image::ExifTool, I found that it sometimes returns data
structures with cycles in it. My program creates lots of Image::ExifTool
objects and I suspect that they are not being garbage collected.
Test case below. Run with no arguments to get one list of cycles, and
run with a valid JPEG to get a much bigger list:
#!/usr/bin/perl
use strict;
use Image::ExifTool;
use Devel::Cycle;
my $data = 'random junk';
if ($ARGV[0]) {
local $/ = undef;
open(F, $ARGV[0]);
$data =<F>;
close(F);
}
my $et = new Image::ExifTool;
my %exif;
my $foundexif = $et->ExtractInfo(\$data, \%exif);
#my $info = $et->GetInfo();
find_cycle($et);
#find_cycle(\%exif);