+ if (ServerInstance && ServerInstance->Logs)
+ ServerInstance->Logs->Log("CULLLIST", DEBUG, "classbase::+ @%p", (void*)this);
+}
+
+CullResult classbase::cull()
+{
+ if (ServerInstance && ServerInstance->Logs)
+ ServerInstance->Logs->Log("CULLLIST", DEBUG, "classbase::-%s @%p",
+ typeid(*this).name(), (void*)this);
+ return CullResult();
+}
+
+classbase::~classbase()
+{
+ if (ServerInstance && ServerInstance->Logs)
+ ServerInstance->Logs->Log("CULLLIST", DEBUG, "classbase::~ @%p", (void*)this);
+}
+
+CullResult::CullResult()
+{
+}
+
+// This trick detects heap allocations of refcountbase objects
+static void* last_heap = NULL;
+
+void* refcountbase::operator new(size_t size)
+{
+ last_heap = ::operator new(size);
+ return last_heap;
+}
+
+void refcountbase::operator delete(void* obj)
+{
+ if (last_heap == obj)
+ last_heap = NULL;
+ ::operator delete(obj);
+}
+
+refcountbase::refcountbase() : refcount(0)
+{
+ if (this != last_heap)
+ throw CoreException("Reference allocate on the stack!");
+}
+
+refcountbase::~refcountbase()
+{
+ if (refcount && ServerInstance && ServerInstance->Logs)
+ ServerInstance->Logs->Log("CULLLIST", DEBUG, "refcountbase::~ @%p with refcount %d",
+ (void*)this, refcount);
+}
+
+usecountbase::~usecountbase()
+{
+ if (usecount && ServerInstance && ServerInstance->Logs)
+ ServerInstance->Logs->Log("CULLLIST", DEBUG, "usecountbase::~ @%p with refcount %d",
+ (void*)this, usecount);
+}
+
+ServiceProvider::~ServiceProvider()
+{