13 ms·
That's all fine for locals. How about members of objects? The object may be long-lived, the buffer it uses may be short-lived, and it can hang around unless you
by JoeAltmaier 5y ago
That's all fine for locals. How about members of objects? The object may be long-lived, the buffer it uses may be short-lived, and it can hang around unless you remember to null it.
Remembering to null references is not much easier than remembering to delete things. It's trading one issue for another.
And now there's two ways to remember to manage memory.
- deleted 5y ago[deleted]
- deleted 5y ago[deleted]
- nine_k 5y agoEasy: objects should not normally have members with different lifetimes, and ideally any mutable members at all. There are exceptions to that, like queues and caches, but they are few and should be closely watched.