
AMDG
Peter Dimov wrote:
gchen wrote:
But it seems that quick_allocator never free the memory pool (blocks) after my program exits, do I miss something?
It doesn't. After your program exits, all memory is automatically freed by the OS. There's no need to free it explicitly, except maybe to keep simplistic leak checkers happy.
Maybe we can have a special allocation function for when the memory might never be freed.
void* allocate_potentially_unfreed_memory(std::size_t size) { #ifdef BOOST_SIMPLISTIC_LEAK_CHECKER char* result = static_cast<char*>(::operator new(size + (std::max)(MAXIMUM_ALIGNMENT, 16))); std::strcpy(result, "boost::unfreed"); return(result + (std::max)(MAXIMUM_ALIGNMENT, 16)); #else return(::operator new(size)); #endif } In Christ, Steven Watanabe