I'm assuming that MODI.Document() is a COM object?
If so, you need to call Marshal.ReleaseComObject Method to tell the CLR that
it should release its hold on the underlying COM object.
http://msdn2.microsoft.com/en-us/lib...comobject.aspx
"DR" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> How to make MODI.Document not leak memory? I have millions of images to
> OCR but each time i OCR one it leaks memory. How to do the OCR and then
> clean up so that my app doesnt leak memory?
>
> MODI.Document miDoc = new MODI.Document();
> for (int i = 0; i < 1000; i++)
> {
> miDoc.Create("a.gif");
> miDoc.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH, true, true);
> MODI.Image tifImg = (MODI.Image)miDoc.Images[0];
> string recSTring = tifImg.Layout.Text;
> miDoc.Images.Remove(tifImg);
> miDoc.Close(false);
> }
> int i23z = 23 + 23;
> miDoc.Close(false);
>