Eager Initialization

The ImageSDK has a global set of buffers and caches. For minimal memory usage, these are initialized “as needed”, meaning they are allocated upon first use. Specifically, the Convert pipeline requires a lot of memory (multiple gigabytes), which is allocated when the first conversion is executed.

To avoid the overhead of this memory allocation when triggering the first conversion, the ImageSDK can be forcefully initialized as follows:

P1::ImageSdk::Initialize();
P1.ImageSdk.Sdk.Initalize();

Calling the Initialize method will cause allocation of all needed buffers and caches in the ImageSDK.

Note

Currently, there is no way of freeing the allocated buffers again. The ImageSDK will hold on to the memory until the host process is terminated. However, the allocated buffers are used only when actively decoding or converting images. This means the OS is free to utilize memory swapping and memory compression, when the memory is not part of the process’s active working set.