Jaimi wrote:
Well, I've tried to post several links to you in different ways to help out with understanding why you should dispose objects that have unmanaged resources. However, your phpbb setup will not allow me to post links, and eats any replies that contain them, regardless of how I enter the link.
They all boiled down to this: The GC has NO knowledge of unmanaged resources. Unmanaged resources (such as pen, brush, and font handles) are finite. The GC will only free up and finalize things when it feels there is pressure to do so, but it doesn't take into consideration the unmanaged resources.; Since the finalizer is not called automatically when something goes out of scope (IMO, the biggest flaw in C#), the Dispose method was invented to free up resources like this.
This is my last response on this topic - I'm just trying to help. If you don't want that help, that's fine. I will just keep my changes to myself.
I have 20 years of experience writing large and small software systems, 5 years of that in C#. I've been to Microsoft, attended the PDC's (spoken to Anders Hejlsberg on this very subject!). My applications process checks and print millions of bank statements every month - approximately 5% of the US market (no I'm not rich, though). In this sort of environment, you have to really be careful with memory and resources.
I didn't want to upset you. In general all contributions are welcome.
This forum has a new anti-Spam module (we cannot control that, sorry) that will reject anything that looks like a URL (including the using-statements of C# code). Users registered for 5+ days with 5+ posts are no longer filtered.
You can call
Code:
GC.Collect();
GC.WaitForPendingFinalizers();
anytime to make sure that all unneeded GDI+ resources are disposed.
That's one way to go; you suggest to call Dispose() in PDFsharp to free those resources; that's another way to go - and probably the better way.
So far I haven't heard of problems with PDFsharp caused by limited GDI+ resources.