3 ms·
I think there is a misconception around GC, you could still be retaining memory you didn't intend to. It won't lead to a dangling pointer, but there is still a
by nraynaud 12y ago
I think there is a misconception around GC, you could still be retaining memory you didn't intend to. It won't lead to a dangling pointer, but there is still a need for some kind of assertion of the effect: "I know this object should be collected at this point in time", and some complex tools to analyse the retention path. Because even if the object is still valid on a memory point of view, it could still be in a inconsistent state if you thought it was not retained, but it is, and now it goes into a pipeline of code that can't handle its state etc. Imagine a closed file handle that you forgot to remove from a collection or something like that.
The memory errors in C++ are not exactly memory error, they are, like other errors, a misconception on the state of the object graph. And it's hard to find and fix.