Skip Menu |

This queue is for tickets about the Image-ExifTool CPAN distribution.

Report information
The Basics
Id: 79838
Status: rejected
Priority: 0/
Queue: Image-ExifTool

People
Owner: Nobody in particular
Requestors: philip [...] gladstonefamily.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 9.01
Fixed in: (no value)



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);
Thanks for this report, however I'm not sure there is a problem. When ExifTool is run, the memory is expected to grow as new tag tables are loaded and members of the static tag information tables are filled in. However, the memory should not continually grow if the same file (or a file with similar metadata) is processed again. The Devel::Cycle utility is of limited use because the cycles that it finds are from tag information that is never freed anyway. If you have an example of a file that causes the memory to grow continuously when it is processed repeatedly, please send it to me so I can track down the problem. My mail is phil at owl.phy.queensu.ca - Phil
Subject: Re: [rt.cpan.org #79838] Potential memory leak in Image::ExifTool
Date: Tue, 25 Sep 2012 08:53:04 -0400
To: bug-Image-ExifTool [...] rt.cpan.org
From: Philip Gladstone <philip [...] gladstonefamily.net>
Phil I must apologise for impugning Image::ExifTool. It turns out that I have found a memory leak in 'tempfile' from File::Temp. This seems rather unlikely, but I'll dig into it..... Philip On 9/25/2012 8:04 AM, Phil Harvey via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=79838 > > > Thanks for this report, however I'm not sure there is a problem. > > When ExifTool is run, the memory is expected to grow as new tag tables are loaded and > members of the static tag information tables are filled in. However, the memory should not > continually grow if the same file (or a file with similar metadata) is processed again. > > The Devel::Cycle utility is of limited use because the cycles that it finds are from tag information > that is never freed anyway. > > If you have an example of a file that causes the memory to grow continuously when it is > processed repeatedly, please send it to me so I can track down the problem. My mail is phil at > owl.phy.queensu.ca > > - Phil >
-- Philip Gladstone Ham Radio (N1DQ) and Weather Data Collector