Hi,
There is a resource leak in AcquireVirtualMemory resulting in major performance degradation whenever AcquireMagickResource starts returning false. The problem is that AcquireMagickResource calls are not paired with calls to RelinquishMagickResource if a resource limit is hit.
Eventually all allocations and pixel caches will start using file-backed storage leading to major performance degradations.
Another issue is that AcquireVirtualMemory does not remove temporary files created for failed file-backed memory mappings. This has been adressed in IM 7.
I have created a pull request for you to review: https://github.com/ImageMagick/ImageMagick/pull/75
Something I've discovered is that OpenPixelCache and AcquireVirtualMemory count resources a bit differently.
AllocatePixelCachePixels attempts an anonymous mapping when regular allocation fails, thus counting towards the Memory limit, while AcquireVirtualMemory counts them towards the Map limit.
Best regards,
Anders
Resource leak in AcquireVirtualMemory
Re: Resource leak in AcquireVirtualMemory
We applied your patch to the GIT master and branches. Thanks for your contribution.
We'll also add a patch to fix the memory vs. map resource allocation. Thanks for alerting us to the problem.
We'll also add a patch to fix the memory vs. map resource allocation. Thanks for alerting us to the problem.
Re: Resource leak in AcquireVirtualMemory
Great, thanks!