Boost logo

Boost :

From: Darren Cook (darren_at_[hidden])
Date: 2004-01-27 23:36:01


I've a class using the boost quick_allocator like this:

class Chain{
//...
void* operator new(std::size_t sz){
        return boost::detail::quick_allocator<Chain>::alloc(sz);
        }
void operator delete(void *p,std::size_t sz){
        boost::detail::quick_allocator<Chain>::dealloc(p,sz);
        }
//...
};

I've started using valgrind ( http://valgrind.kde.org/ ) to look for memory
problems in my unit tests and it is complaining that the memory is never
released.

Now I understand this:
        // "Listen to me carefully: there is no memory leak"
        // -- Scott Meyers, Eff C++ 2nd Ed Item 10

But is there some function I can call at the end of my program to:
   a) confirm I've called dealloc() for every alloc() and that the next
pointer is currently at start
   b) release the memory.

Valgrind supports suppressing the complaint but the check of deallocs
matches allocs would be a useful test anyway.

Darren


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk