"Too many open files" AND "error: can't allocate region"

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
fellowshipofone

"Too many open files" AND "error: can't allocate region"

Post by fellowshipofone »

Hi,

I am trying to create 256*256px PNG images from a 32768*32768px file.

Note: It works just great with a 8192*8192px file, so the software is really just hitting limits.

Bug #1
On Machine 1, Mac Book Pro 4GB RAM, I ran out of memory and swap quickly as "convert" required about 15GB of RAM. When switching to "-limit area 0", I quickly got this "Too many open files" errors and there does not seem to be anything I can do using "-limit files 128" or anything similar.

convert -limit area 0 -monitor sourceimage.jpg -crop 256x256 +repage png32:resultimages.png

(Updated: here is what I get precisely)

Code: Select all

load image[map-U7ghOq]: 32767 of 32768, 100% complete
Mogrify[Image]: 2502 of 2503, 100% completeplete
convert: unable to open file `/var/folders/g5/g5EFHciNGBirywxQFvfIwU+++TI/-Tmp-/magick-sOQZSjns': Too many open files @ cache.c/ReadPixelCachePixels/4731.
Bug #2
On Machine 2, Mac Pro with 13GB RAM, I have not monitored it but I (unexpectedly?) ran out of memory twice. The second time I used "-limit area 10gb" which did not change anything. Here is the output I get both times:

convert -monitor sourceimage.jpg -crop 256x256 +repage png32:resultimages.png

Code: Select all

load image[map-ITLVaB]: 32767 of 32768, 100% completeete
convert(87563) malloc: *** mmap(size=524288) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
convert(87563) malloc: *** mmap(size=524288) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
convert(87563) malloc: *** mmap(size=524288) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
convert(87563) malloc: *** mmap(size=524288) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
convert(87563) malloc: *** mmap(size=524288) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
convert(87563) malloc: *** mmap(size=524288) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
convert(87563) malloc: *** mmap(size=524288) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
convert(87563) malloc: *** mmap(size=24576) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
convert: Memory allocation failed `Cannot allocate memory' @ string.c/AcquireStringInfo/173.

Either way, my problem needs a quick solution, so a

I have seen both bugs reported for earlier releases of IM. Right now I am running ImageMagick @6.5.9-0_0+q16 installed with MacPorts.

Thanks for your help.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: "Too many open files" AND "error: can't allocate regi

Post by magick »

We can reproduce the problem you posted and will have a patch in ImageMagick 6.5.9-4 by sometime tomorrow. Thanks.
fellowshipofone

Re: "Too many open files" AND "error: can't allocate regi

Post by fellowshipofone »

Thanks a lot! I really appreciate the quick answer.
Post Reply