Killing stray GDI objects

  • Thread starter Thread starter jislord
  • Start date Start date
J

jislord

C# noob alert...

I am using a third party dll file to do some processing on rtf files.
This dll however leaks GDI objects like there is no tomorrow. It
crosses the threshold of 10000 objects after processing just a 100
files. While I can work with the developers on the third party team for
a long term solution, is there a quick fix for me to use right now? Is
there some-way I can make the Garbage collector destroy these GDI
objects once they cross a threshold?
 
C# noob alert...

I am using a third party dll file to do some processing on rtf files.
This dll however leaks GDI objects like there is no tomorrow. It
crosses the threshold of 10000 objects after processing just a 100
files. While I can work with the developers on the third party team for
a long term solution, is there a quick fix for me to use right now? Is
there some-way I can make the Garbage collector destroy these GDI
objects once they cross a threshold?

I'd think GC.Collect is about all you can do.

Michael
 
C# noob alert...

I am using a third party dll file to do some processing on rtf files.
This dll however leaks GDI objects like there is no tomorrow. It
crosses the threshold of 10000 objects after processing just a 100
files. While I can work with the developers on the third party team for
a long term solution, is there a quick fix for me to use right now? Is
there some-way I can make the Garbage collector destroy these GDI
objects once they cross a threshold?

I don't think there is any way to tell the GC to kill objects containing
GDI handles.
The only thing I could think of is to load the third party dll in its
own AppDomain and unload/reload that from time to time. I think the
operating system will automatically free all handles that are still in
use when the AppDomain gets unloaded. Though that's ugly as hell... I'd
just try to get them to fix that asap!

Max
 
Back
Top