Add simple object reference count tracking

To be able to build some advanced structures (like copy-on-write binary
search trees) we need to track references

This adds a common interface for object references and destructors

Signed-off-by: Max Sikstrom <msikstrom@op5.com>
Add initial support for Copy-on-write trees.

Only adding/replacing is available yet though.

Signed-off-by: Max Sikstrom <msikstrom@op5.com>