Impact Acquire SDK Java
Random 'bad_alloc' Exceptions When Running With Active Image Processing Filters

Symptoms

When running an application that makes use of one or more of the Impact Acquire internal image processing algorithms (e.g. the Bayer filter) in an environment were a lot of memory is allocated and freed frequently on the heap and memory resources are limited (e.g. when running a 32-bit process) bad_alloc exceptions are thrown from within Impact Acquire after some time.

Cause

By default the image processing algorithms of Impact Acquire is configured in a way that memory is allocated as needed and freed as fast as possible thus when not needed any more. This reduces the memory footprint to a minimum but when a lot of other small or large allocations on the heap take place as well this might result in a fragmented heap. After some time this might result in the heap being fragmented to such an extend that buffer needed to convert images as a whole can no longer be allocated. In such a case the C/C++ runtime library might raise a bad_alloc exception.

Resolution

Impact Acquire addresses this problem by the introduction of the property

Figure 1: ImpactControlCenter - ImageProcessingOptimization


The effects of this property are described here: Image Processing.