PC Review


Reply
Thread Tools Rate Thread

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?

 
 
DR
Guest
Posts: n/a
 
      5th Feb 2008
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);


 
Reply With Quote
 
 
 
 
Scott M.
Guest
Posts: n/a
 
      5th Feb 2008
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);
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
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? DR Microsoft C# .NET 2 5th Feb 2008 03:52 AM
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? DR Microsoft Dot NET 1 5th Feb 2008 12:43 AM
Need help with a log off/log on problem...can log off then log on dif. user and system will be slow loading user settings, then play start up music, then show wallpaper, then freeze. Ralph Malph Windows XP General 2 9th Feb 2005 07:05 AM
Memory leaks? COM leaks? Outlook won't unload. Simon Smith Microsoft Outlook Program Addins 1 14th Mar 2004 09:05 AM
tmp files - millions and millions of 'em! J. Shrimp, Jr. Microsoft Excel Misc 1 21st Jan 2004 02:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:38 PM.