Boost logo

Boost :

From: Steven Watanabe (steven_at_[hidden])
Date: 2007-01-14 18:24:58


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


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