Memory Usage with HDIB

  Imaging Toolkit

Developers must specifically free up DIBs when they are finished with them. The Black Ice functions DO NOT do this automatically. To free up a DIB, use the Microsoft API’s GlobalUnlock or GlobalFree functions. These functions will allow developers to both unlock and free the memory.

If one experiences that the system is running out of resources or experiences a memory leak in an application then the most likely cause of it is that the hDIB is not freed up correctly. The hDIB object is used to store loaded images and the hDIB object has to be freed once it is no longer required.

Make sure that the hDIB variable is not overwritten before it is freed up. For example, avoid the following: hDIB = hTempDIB where hDIB is a current image and the hTempDIB is a new rotated image. This will result in a memory leak since the hDIB variable was not correctly dropped.

Regards,
Technical Support Team