c# memory leaks or blind faith coding


I think the title roughly explains how I feel about the recent code project article regarding a memory leak in the Princeton team's code. Note the semantics there, not a c# memory leak, a leak in their code.

You know what that sounds like someone writing on their project is to blame, screw that. Let's blame the language it was written in. Ignoring the fact that any language faces the same issue. If you allocate something and then don't get rid of it bad things happen. Since C# is a lazy person's language (garbage collected), it'll get rid of those somethings, so long as it knows you don't need them anymore. Apparently the magic event handling in C# prevented them from cleaning up their listeners. I'm surprised that the event based leak was their only leak considering the lack of understanding it demonstrates. Events in C# are just a nice abstraction for a function (delegate) list.

Suffice it to say that their leak is possibly in all programming languages I can think of. Primarily because it is due to programmer error. It's akin to leaving the water on in the tub and blaming the tub for overflowing.