+}
+
+// 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->Log("CULLLIST", LOG_DEBUG, "refcountbase::~ @%p with refcount %d",
+ (void*)this, refcount);
+}
+
+usecountbase::~usecountbase()
+{
+ if (usecount && ServerInstance)
+ ServerInstance->Logs->Log("CULLLIST", LOG_DEBUG, "usecountbase::~ @%p with refcount %d",
+ (void*)this, usecount);
+}
+
+ServiceProvider::~ServiceProvider()
+{
+}
+
+void ServiceProvider::RegisterService()
+{
+}
+
+ExtensionItem::ExtensionItem(const std::string& Key, ExtensibleType exttype, Module* mod)
+ : ServiceProvider(mod, Key, SERVICE_METADATA)
+ , type(exttype)
+{
+}
+
+ExtensionItem::~ExtensionItem()
+{
+}
+
+void* ExtensionItem::get_raw(const Extensible* container) const
+{
+ Extensible::ExtensibleStore::const_iterator i =
+ container->extensions.find(const_cast<ExtensionItem*>(this));
+ if (i == container->extensions.end())
+ return NULL;
+ return i->second;
+}
+
+void* ExtensionItem::set_raw(Extensible* container, void* value)
+{
+ std::pair<Extensible::ExtensibleStore::iterator,bool> rv =
+ container->extensions.insert(std::make_pair(this, value));
+ if (rv.second)