Page 1 of 1

.Net 2.0 File Handles

Posted: 2007-06-13T12:40:34-07:00
by offback
Hello all,
Anyone have problems with this COM+ object not closing the temp files. I'm converting a ton of Images from JPG to EPS in a .net application. I've tried both the ImageMagickObject and MagicKNet and both seem to leave the temp files open until I exit the application, I am disposing of the object I create in my application but that does not help. For now I can only convert about 400 images then I have to close the application and re-launch before I can continue. Because the system runs out of file handles. I forget the exact error message but I know if I go to the temp folder and try and delete one of the temp files it tells me its in uses.

Thanks
Phil

Here is a code snippet:

using (OrgImage = new MagickNet.Image())
{
OrgImage.Read(OImage);
OrgImage.Write("EPT2:C:\TEMP\"+ ImageName);
}

Re: .Net 2.0 File Handles

Posted: 2007-06-13T13:00:24-07:00
by magick
Is there a method to force garbage collection? ImageMagick does not free resources until an image object is destroyed.

Re: .Net 2.0 File Handles

Posted: 2007-06-13T13:37:35-07:00
by offback
Thanks for the quick reply. There is a GC command and I tried to run it after my using statement but it didn't seem to be effective. I'll look more at the .Net Garbage Collector maybe I can make it be more forceful about Garbage Collection..

Thanks again
Phil