Item 7 Revisited
There is a discussion on
http://stackoverflow.com/questions/1332015/using-class-specific-set-new-handler/1332080#1332080
Item 7: Be Prepared for Out-of-memory Conditions
When operator new
cannot satisfy a request for memory, it calls the new-handler function not once, but repeatedly unTIL it can find enough memory.
The handler can use do one of the following:
A Way to Remove a Certain Layer Form a UIView’s Layers
A way to remove a certain layer form a UIView’s layers
Item 6: Use Delete on Pointer Members in Destructors
Summary:
- deleting a null pointer is always safe
- Do not delete a pointer that was passed into a class in the first place