Cache resources exhausted

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Locked
jmspaggi
Posts: 29
Joined: 2020-02-09T15:15:17-07:00
Authentication code: 1152

Cache resources exhausted

Post by jmspaggi »

Hi,

Seems that I'm facing a similar issue as this thread.

Code: Select all

(base) jmspaggi@precision5530:/media/jmspaggi/Puzzle$ convert +append input_black_01.tif input_black_02.tif input_black.tif
convert-im6.q16: cache resources exhausted `input_black_01.tif' @ error/cache.c/OpenPixelCache/4083.

Code: Select all

(base) jmspaggi@precision5530:/media/jmspaggi/Puzzle$ identify -list resource
Resource limits:
  Width: 16KP
  Height: 16KP
  List length: 18.446744EP
  Area: 128MP
  Memory: 256MiB
  Map: 512MiB
  Disk: 1GiB
  File: 768
  Thread: 12
  Throttle: 0
  Time: unlimited
I have 11GB of free storage space and 22GB of free memory. Input files are about 80MB each. I tried to play with the -limit parameter without any success.

Code: Select all

(base) jmspaggi@precision5530:/media/jmspaggi/WESTY/Puzzle$ convert -version
Version: ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP 
Delegates (built-in): bzlib djvu fftw fontconfig freetype heic jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png tiff webp wmf x xml zlib
Seems that limit with "20gb" returns very quickly but limit with "20GB" seems to run longer but still fails. Playing more with the parameter, 1m gives one byte. 1M gives 1 meg. 1g gives one byte. 1G gives 256 megs. It seems that it can not be increased above 256 megs.The same way it seems that it's not possible to increase the disk above 1G.

Any idea what is going wrong?

Thanks.

User avatar
magick
Site Admin
Posts: 11254
Joined: 2003-05-31T11:32:55-07:00

Re: Cache resources exhausted

Post by magick »

Increase your Disk policy limit. Its currently 1GiB. Your command creates a pixel cache on disk that exceeds this limit and due to the policy restriction throws an exception.

jmspaggi
Posts: 29
Joined: 2020-02-09T15:15:17-07:00
Authentication code: 1152

Re: Cache resources exhausted

Post by jmspaggi »

I'm not able. What ever number I put it limits it to 1GB:(

I can decrease the limit, I can not increase it.

I tried -limit 20G, says 1GB. If I say limit 1B, then it says one byte. anything under 1GB works, abythit above 1GB says 1GB. I'm probably doing something wrong.

jmspaggi
Posts: 29
Joined: 2020-02-09T15:15:17-07:00
Authentication code: 1152

Re: Cache resources exhausted

Post by jmspaggi »

Here is an illustration of what I'm saying above.

Code: Select all

(base) jmspaggi@precision5530:/media/jmspaggi/Puzzle$ identify -limit memory 200MiB -list resource
Resource limits:
  Width: 16KP
  Height: 16KP
  List length: 18.446744EP
  Area: 128MP
  Memory: 200MiB
  Map: 512MiB
  Disk: 1GiB
  File: 768
  Thread: 12
  Throttle: 0
  Time: unlimited
(base) jmspaggi@precision5530:/media/jmspaggi/Puzzle$ identify -limit memory 300MiB -list resource
Resource limits:
  Width: 16KP
  Height: 16KP
  List length: 18.446744EP
  Area: 128MP
  Memory: 256MiB
  Map: 512MiB
  Disk: 1GiB
  File: 768
  Thread: 12
  Throttle: 0
  Time: unlimited
Give that I have 32GB of memory, with 22GB free, I was hoping to get something like this working:

Code: Select all

identify -limit memory 20480MiB -list resource
But this also gives only 256MiB of memory for the cache :(

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Cache resources exhausted

Post by snibgo »

jmspaggi wrote:I can decrease the limit, I can not increase it.
I suppose you did this with "-limit" options on the command line. Yes, these are only more restrictive. You need to change the limits in policy.xml.
snibgo's IM pages: im.snibgo.com

jmspaggi
Posts: 29
Joined: 2020-02-09T15:15:17-07:00
Authentication code: 1152

Re: Cache resources exhausted

Post by jmspaggi »

Ha!!!!

Updating /etc/ImageMagick-6/policy.xml gives me what I want. Limits in the policy.xml file are maximum. So the 256MiB defined there by default is a maximum. Using the -limit command allows you to reduce this maximum, in case you are running low on memory or other. But you can't increase it.

This post has pointed me to the right direction.

(Just seeing snibgo post now. Thanks. I just ran my convert command successfully!)

Locked