That was good reading but I'm afraid I didn't find what I was looking for (maybe I haven't been looking hard enough), and after reading my first post again I realized it was a bit... fuzzy. Here's is a better description of my problem.
I'm using a mark-sweep memory manager which, in the beginning of the program, allocates a big chunk of memory. I have then overloaded the new operator so that I can simply call the memory managers allocate method by writing:
Code:
Foo* foo = new Foo;
//I haven't got the code right here, but it looks something like:
void * operator new(size_t nBytes)
{
return g_pMemMgr->alloc(nBytes);
}
The memory manager then finds a suitable block, splits it if necessary, and returns the memory address. When I no longer need to use this foo variable I just leave it right where it is. The memory manager then looks through the whole memory after pointers to the blocks of memory it has. If it doesn't find a pointer to a certain block it flags it as free. At that place I want the memory manager itself to call the proper destructor of a void* type memory piece. I have read this is possible but the author of the article didn't really say how, and my attempts at using google has failed utterly.
Thanks for your response though, it was very interesting reading!
After reading it I begin to wonder if even the contructors of my objects are called, got to check that.