C++ Exit-Time Destructors
maskray.me
maskray.me
Why _should_ we care? Even here, you're not providing a technical justification but instead make a quixotic appeal to emotion. I have listened to talks from HFT guys where they claim to deliberately ignore memory leaks if it produces faster code. They just buy more ram, and rely on the OS clean it up at the end of the trading day. Seems reasonable to me.
I always drag out the old Steve Jobs quote to explain my (evidently dying) attitude about Invisible Quality: “When you’re a carpenter making a beautiful chest of drawers, you’re not going to use a piece of plywood on the back, even though it faces the wall and nobody will ever see it. You’ll know it’s there, so you’re going to use a beautiful piece of wood on the back. For you to sleep well at night, the aesthetic, the quality, has to be carried all the way through.”
Note that this does not create a memory leak, since the pointer/reference is part of the root set.
What does valgrind say?I tend to add that to software I write inside an #ifdef NDEBUG.
The OS does the work faster.
> Note that this does not create a memory leak, since the pointer/reference is part of the root set.
Can someone explain this to me? How would that not be a memory leak? What does 'root set' mean in this context?
Technically, this is still a memory leak, it's just considered less serious.