Boost logo

Boost :

From: Daniel James (daniel_james_at_[hidden])
Date: 2008-02-07 19:10:28

On 07/02/2008, Michael Marcin <mmarcin_at_[hidden]> wrote:
> I'm on a platform where no memory can be dynamically allocated before
> main and all dynamically allocated memory must be released before main
> returns. Is there a way to ensure this behavior with boost's unordered
> containers if they have static duration?

No, there isn't, which is pretty much what you'd expect from the
standard. Although, I think it is possible to do without breaking the
standard. I'm not sure if 'clear' can free all memory though, as I'm
sure if it can change the bucket count.

I'm not sure about this. I initially started to write a fairly
negative reply, but as I thought it through I realised that it might
be pretty cheap to implement and might be desirable on other platforms
as well. Is this a common requirement?

Of course, it's also possible to use the preprocessor to only support
this on certain platforms, but that could cause maintenance problems
so I wouldn't want to do that.

I'll think about it some more.


Boost list run by bdawes at, gregod at, cpdaniel at, john at