Re:Pointers and memory leaks in C
by yoklov on Friday October 10, 2014 @03:39PM
(#8439635)
Most people who write C professionally have no trouble doing this, but memory leaks still occur.
It's easy to miscommunicate what part of the code manages what memory if you're working in a group, not to mention just normal human error. It's very easy to accidentally forget to free something, especially when you're on a tight schedule or distracted. I mean, how many times have you wondered 'how did this ever work' when looking through old code you wrote?
That said, most of these problems are significantly lessened by C++ (though it's obviously not a panacea).
It's easy to miscommunicate what part of the code manages what memory if you're working in a group, not to mention just normal human error. It's very easy to accidentally forget to free something, especially when you're on a tight schedule or distracted. I mean, how many times have you wondered 'how did this ever work' when looking through old code you wrote?
That said, most of these problems are significantly lessened by C++ (though it's obviously not a panacea).