Memory Leakage Issue

Document Imaging SDK,
Image SDK,
Annotation SDK,
Cover Page Generator

Moderator: Technical Support Team

Memory Leakage Issue

Postby ajitsubudhi2000 » Tue Apr 24, 2007 2:43 am


We are developing a scanning application, for this we are using Document Imaging SDK-v10.We are capturing the hdib value of the scanned images in batchpage_done event of bitwain control and assigning this hdib value to blackice display control bidisp as bidisp.hdib=hdib. When the next image is scanned and we want to clear the display control as bidisp=0 and assigns the new scanned hdib to bidisp control , there is a memory leakage, and as more and more images are being scanned and displayed on bidisp control the memory increases and it reaches a state where we get invalid bitmap error.We have gone through the forum, documentation of blackice but everywhere we found that :

Memory Usage with HDIB from Document Imaging SDK documentation :

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

If one experience 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

But we didn’t get any solution how to use the globallock/globalunlock /globalfree concepts in code .I have gone through the samples also I didn’t get any solution how to drop the hdib and to free the hdib memory reference value from memory before assigning new hdib to bidisp control.

We are using language. So please send some sample code how to handle the above situation for memory leakage.

Thanx & Regards

Ajit Kumar
Posts: 4
Joined: Thu Jan 25, 2007 6:49 am
Location: Chandigarh


Postby TechnicalSupportTeam » Wed Jun 06, 2007 4:49 pm

For VB.NET, we have a DropDIB method that you can use to free the DIB. Please take a look at the documentation for the "DropDIB" method.
Posts: 1002
Joined: Sat Mar 20, 2004 11:50 am

Postby barry_h » Tue Nov 13, 2007 1:09 pm

We found a similar memory leak. Setting the hDIB = 0 was not working.

This has since been fixed. Make sure you have the latest update.
Posts: 2
Joined: Thu Feb 22, 2007 2:22 pm

Re: Memory Leakage Issue

Postby Matthew » Wed Aug 31, 2011 12:11 am

You should open up Windows Task Manager. You can do this by pressing Ctrl+Shift+Esc. Then click the Processes tab. Then click on the Memory (Private Working Set) column to organize the processes from most memory to least memory. Then check and see where IE8 is at. If it is at the top and the number of memory used keep going up, then you may have a memory leak. Good luck.

natural hair care products
Posts: 6
Joined: Mon May 02, 2011 6:13 am

Return to Imaging Toolkits

Who is online

Users browsing this forum: No registered users and 1 guest