Developers must specifically free up DIBs when when they are finished with the DIBs. The Black Ice functions DO NOT do this automatically. To free up a DIB, use the BIDisp.OCX’s DropDIB or DropBitmap method. These methods will 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 over written 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.
If you use BiDisp control for displaying images, do not call DropDIB method for the DIB stored in the hDib property of the BiDisp control. If you change the hDib property of BiDisp or set the hDib property to 0, the BiDisp.ocx deallocates the memory of the DIB internally.