I had a conversation about the merits of garbage collection vs. its tendency to cause complacency in developers in regards to memory management. My personal feeling is that as computers are getting faster and applications are getting more complicated, it’s important that we create reliable tools to allow our developers to accomplish more with less code. Garbage collection frees the developer up from worrying about the complicated internals of allocating and releasing memory. At the same time, we can’t believe that this means we don’t need to be careful about memory management. It just means we do so at a higher level. We still have to be wary of circular references and globals that never free from scope.
An article went up on Ajaxian today about memory fragmentation in FireFox. It discusses one of the more intricate challenges associated with manually managing memory. This is in contrast to another article I read recently describing garbage collection in Ruby. In this article, Why describes the garbage collection mechanism used by Ruby and how it affects the performance of code as well as providing useful tips for getting the most out of your application. Both of these articles describe performance issues cause by memory management systems. Read them both and decide which problem you’d rather have in your code.