Putting refcounting from SGObject to new super class SGRefObject.
Fix libshogun example (preventing segfault when shogun_exit() is called before
kernel objects are destroyed)