.Net 2.0 File Handles

ImageMagickObject is a Windows COM+ interface to ImageMagick. COM+, Visual Basic, and Delphi users should post to this discussion group.
Post Reply
offback

.Net 2.0 File Handles

Post 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);
}
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: .Net 2.0 File Handles

Post by magick »

Is there a method to force garbage collection? ImageMagick does not free resources until an image object is destroyed.
offback

Re: .Net 2.0 File Handles

Post 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
Post Reply