
On 07/02/2008, Michael Marcin <mmarcin@method-solutions.com> 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. Daniel