I use boost shared_ptr with my own memory manager like this (stripped down example, I hope there are no errors in it):
class MemoryManager { public: inline void* allocate(size_t nbytes) { return malloc(nbytes); } inline void deallocate(void* p) { free(p); } }; MemoryManager globalMM;
And I use it like this:
shared_ptr<Object>(new(globalMM) Object, Deleter);
But now I understand. If shared_ptr removes my onject, it calls Deleter :: operator () and the objects are deleted. But the destructor is not called ...
How can i change this?
source share