Resource leak in AcquireVirtualMemory
Posted: 2016-01-07T05:29:00-07:00
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
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