With the garbagecollector in C# I haven’t really paid but attention to this ‘phenomena’ (not a really a phenomena but rather a logical result). When I did an iPhone application I used a cross platform tool, and in the forums there was a lot of debate that memory was poorly handled and there was a lot of memory leaks (I assume that is fixed now, but who knows). It got me a bit curious, but as always, it got pushed to the back of my mind for later thinking. I keep a list of all my questions, and must-look-this-up things. And as I reviewed the list today I came across these three notes:
What is the definition of a memory leak? //This note was from my first month programming
My definition I had scribbled down next to the question:
Applications obtain memory for temporary use when they run, and they are supposed to return/ let go of this temporary memory when it is not needed anymore. There isnt an infinitive amount of memory available, and if the applications doesn’t free up the memory it has used you have yourself a memory leak. The application doesn’t use the memory, but that bit of memory is ‘taken’. Over time even tiny memory leaks can have a big impact on an application.
How common are memory leaks in c# apps?
I actually don’t know! I would love to pass on this question to more experienced devs, I haven’t tested my applications with any memory profiler tools yet (but I’ll give JustTrace from Telerik a go next week on a couple of apps since I already have it installed).
What are some common culprits? (Would love some examples if you have 🙂 )