Link Details

Vote early, vote often! When you help pick the links, you'll like DZone better. Login and vote now.
Link 104469 thumbnail
User 285573 avatar

By alashcraft
via davybrion.com
Submitted: Aug 17 2008 / 20:26

Events in .NET are very useful. But if you’re not careful, they might prevent objects from being removed from memory by the Garbage Collector (GC). Let’s call an object that publishes an event a Publisher and an object that subscribes to an event a Subscriber. If a Subscriber subscribes to a Publisher’s event, the Publisher will indirectly hold a reference to the Subscriber (because of how events in .NET are implemented). If the Publisher is an object that will stay around for a long time, this could prevent the Subscriber from being removed from memory when it’s no longer used.
  • 3
  • 0
  • 103
  • 15

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (3)



Voters Against This Link (0)