Christophe,

It would be good to test a modern GM version which supports "resource limited memory". Probably Debian's 1.4 version supports that.

For a version which supports the resource limited memory allocator, you can set 'MAGICK_DEBUG=resource' in the environment prior to running the program. This will cause very verbose output with a tally similar to:

13:27:40 0:0.007952  0.050u 173194 resource.c/unknown/236/Resource:
  memory +65.2MiB/81.0MiB/39.0GiB
13:27:40 0:0.027664  0.190u 173194 resource.c/unknown/818/Resource:
  memory -3.3KiB/81.0MiB/39.0GiB
13:27:40 0:0.027692  0.190u 173194 resource.c/unknown/818/Resource:
.
.
.
13:27:40 0:0.033629  0.220u 173194 resource.c/unknown/818/Resource:
  memory -65.2MiB/0B/39.0GiB

The "0B" at the end means that at least as related to memory allocated by the resource limited memory allocator (used only for non-public allocations), there are no leaks.

The type of leak you seem to be finding is a thread-specific memory allocation leak where a destructor did not fire to free the memory when the thread quit. I don't believe that GetImageDepth() uses thread-specific memory but the "thread arena"s that you are talking about likely do.

For allocations which specifically use a memory allocator, I have had some good luck using Glibc's mtrace.

Bob
--
Bob Friesenhahn
bfrie...@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
Public Key,     http://www.simplesystems.org/users/bfriesen/public-key.txt

Reply via email to