From: Philippe A. Bouchard (philippe_at_[hidden])
Date: 2003-06-05 17:16:13
Philippe A. Bouchard wrote:
> Let's say the placement operator new is using malloc(), then we could
> some reverse lookup into mallinfo to find the heap block in which some
> address is related to. This information could then be cached into
> the smart pointer itself making sizeof(smart_pointer) == (sizeof(void
> *) * 2) [if shifted_ptr<> style is to be used]:
Well, let's say the placement operator new pushes back some information
about the block address and it's size into some list< pair<void *, size_t>
>. Forget the C's mallinfo oddity.
This way (or any other derivative), there is no possible leak and no need to
scan the entire graph. A benchmark could help maybe.
[It's too bad I do not have time to study the situation more in depth --
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk