|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Disposing EventHandlersHi,
In a windows app is it necessary to explicity release delegates from events by implementing dispose, or should the framework take care of this? I've read that you only need to implement IDisposable when handling unmanaged resources, which makes sence... however... Investigating a memory leak in a large application there are over 80,000 referrences to a single button in the GC after 30 mins runtime. It seems that not implementing dispose and releasing the references causes this. Can someone confirm? Thanks, Mike Mike,
>In a windows app is it necessary to explicity release delegates from events If you want the object handling the event to be eligible for garbage>by implementing dispose, or should the framework take care of this? collection before the event provider is, you have to remove the handler from the event. Whether that removal code should go in a Dispose method or somewhere else depends on your class design. Mattias -- Mattias Sjögren [C# MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com Please reply only to the newsgroup. |
|||||||||||||||||||||||