Page 1 of 1

memory leak when using the identify command

Posted: 2014-09-21T04:56:16-07:00
by ThomasP8

Steps to reproduce:

Code: Select all

wget http://godandguru.com/favicon.ico
identify -format '%w|%h|%m\n' favicon.ico
This command eats up to 4 GB Memory for a file of 28K.

I'm using the ImageMagick 6.8.9-7 on Mac OS 10.9.4.

Code: Select all

$ identify -version
Version: ImageMagick 6.8.9-7 Q16 x86_64 2014-08-31 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules
Delegates: bzlib freetype jng jpeg ltdl lzma png xml zlib

Re: memory leak when using the identify command

Posted: 2014-09-21T11:06:10-07:00
by snibgo
Confirmed. On IM v6.8.9-5, Windows 8.1 ...

Code: Select all

identify -debug all favicon.ico
... very quickly eats my laptop's 12 GB RAM. And 100% of one CPU. It soons fails with:

Code: Select all

Loading locale configure file "english.xml" ...
2014-09-21T19:03:41+01:00 1:04.048 61.375u 6.8.9 Exception identify.exe[2720]: i
con.c/ReadICONImage/443/Exception
  Memory allocation failed `favicon.ico'
2014-09-21T19:03:42+01:00 1:05.064 62.391u 6.8.9 Cache identify.exe[2720]: cache
.c/DestroyPixelCache/965/Cache
  destroy
identify.exe: Memory allocation failed `favicon.ico' @ error/icon.c/ReadICONImage/44
3.

Re: memory leak when using the identify command

Posted: 2014-09-21T14:56:10-07:00
by magick
Try
  • identify -format '%w|%h|%m\n' 'favicon.ico[0]'
ImageMagick 6.8.9-8, the current release, reports "memory allocation failed" if the [0] is not appended. Firefox reports the image file has errors. Other program complain too. We'll add a patch to detect these errors.

Re: memory leak when using the identify command

Posted: 2014-09-21T15:29:24-07:00
by snibgo
[0] works for me. I can convert favicon[0], and that creates a possible image, though it looks corrupt.