looks like memory-leak in perlmagick-function Statistics()

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
rerdmann
Posts: 2
Joined: 2014-03-28T06:18:28-07:00
Authentication code: 6789

looks like memory-leak in perlmagick-function Statistics()

Post by rerdmann »

I have to analyse some thousand pictures. So I wrote a Perl-script and use the perlmagick-function "Statistics()". Running this script the usage of memory grows permanently until the Computer was out of memory. Debugging the script I notice that every time I use the perlmagick-function "Statistics()" the usage of memory grows. I do not find a workaround to free the memory. I checked and replicate this behavior on Win-XP(32bit) and Win7(64bit) using the current version of perlmagick. So at this moment I would say there is a memory-leak in this function.
Does anyone has an Idea for a workaround or how to fix the problem?

For testing and demonstrating I wrote this lite Script :

Code: Select all

#!/usr/bin/perl -w
use strict;
use warnings;
use Image::Magick;

my $source_URI=”any_picture” ;	# chose a picture you want
my $source_image= Image::Magick->new;
my $Returnvalue = $source_image->Read($source_URI);
my $analysis_area = "10x10+100+100";
my @stat ;
for(my $I=0; $I <5000000; $I++){		
	print("Counter = $I \n");
	my $analysis_image = Image::Magick->new;
	$analysis_image = $source_image->Clone();
	$Returnvalue = $analysis_image->Crop(geometry=>$analysis_area);

	$analysis_image->Statistics();	# here is the problem
	
	@stat = ();			# trying to free the memory
	$analysis_image=();	# trying to free the memory
	undef $analysis_image;	# trying to free the memory
}
undef @stat;
undef $source_image;
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: looks like memory-leak in perlmagick-function Statistics

Post by magick »

We can reproduce the problem you posted and have a patch in ImageMagick 6.8.9-6 Beta, available by sometime tomorrow. Thanks.
Post Reply