keyongtech


  keyongtech > dotnet.languages.* > dotnet.languages.csharp > 02/2008

 #1  
02-04-08, 11:17 PM
DR
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);
 #2  
02-04-08, 11:43 PM
Scott M.
See my other reply in dotnet.framework ng.


"DR" <softwareengineer98037> wrote in message
news:1532
[..]
 #3  
02-05-08, 02:52 AM
Nicholas Paldino [.NET/C# MVP]
DR,

How do you know it is leaking memory? What are you looking at that is
telling you so?

I suspect you are looking at the Memory column in Task Manager, which
isn't how much memory is being consumed, and definitely not an indicator
that you are leaking memory as the value grows.

If not, then the standard caveats apply:

Are these COM objects? If so, then you should call the static
ReleaseComObject method on the Marshal class for ^each^ COM object you
expose. If MODI.Document is a COM object, it exposes a new COM object when
Images is called, for example.

Do the classes implement IDisposable? If so, use in a using block. It
looks like it might, since you have a Close method (which is used similarly
in the framework like the Dispose method on IDisposable (but that doesn't
mean they are the same)).
Similar Threads
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?

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...

To clean up memory leak : Log out or Reboot

Hi, I am developing software on Windows XP, before the code matures normally it has many memory leak problem. I notice that the PC run more and more slower. I normally do a...

Clean up of memory leak in unmanaged code

Hi all I have been wandering about the best way to sandbox memory leaks in 3rd party libraries when using them from the .Net framework. I have a 3rd party library, written...

Memory Leak Detector - leaks in CreateClassEnumerator?

Hi! I ran a check of Memory Leaks, and a few hundred bytes were "leaked" supposedly from the CreateClassEnumerator call. I copied this function from other SDK programs and I...

Flash OCX Memory Leak, Or .Net Framework Memory Leak

Hello All, I have a windows application that uses the Flash OCX v7. The swf's are about 30MB and of course, memory usage goes up when each form is loaded. However, when the...


All times are GMT. The time now is 09:09 PM. | Privacy Policy