I’ve been looking into smart pointer libraries (cos C++ is awfully basic and crap at handling tricky memory situations) and they all seem way too complex for what I want, so I wrote a super simple objC style class.
The class isn’t an automatic/transparent replacement for all pointers or garbage collector. You extend ofxObjCPointer, and then your object will have public retain() and release() methods (plus a private reference count transparent to the user). If you receive a pointer to this object in a function or class, you should call retain() to indicate you need the object (if you need it longterm). Once you’re done with the object you can call release() without fear of having the object deleted while someone else is using it. Once everyone has released the object it is deleted from memory. Super simple, hardly any overheads and safe®.
Theres a sample in the download too.
P.S. the addons site is a bit slow right now, and doesn’t load most of the time…