Killing stray GDI objects

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?
 
M

Michael C

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
 
M

Markus Stoeger

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top