Simple question, what’s more efficient in terms of CPU usage? ScopedPointers or a simple delete? I don’t know if I should use ScopedPointers in some critical objects…
I would imagine that the costs of allocation/deallocation in the runtime’s heap functions would be orders of magnitude higher than the cost of the ScopedPointer operations.
Definitely not something to worry about, at all.
And since ScopedPointer is fully defined at compile time, the compiler will actually not use any additional stack at all for it (it’s a pointer sized object anyway) and instead inline all the method calls.
So it does lower your risks of memory leaks and doesn’t really add any overhead, so use it whenever possible.
Thanks to both, I’m going to abuse from it