Re: Wesnoth memory usage investigation
<dave <at> whitevine.net>
2008-12-02 00:55:33 GMT
Quoting Ignacio Morelle <shadowm2006 <at> gmail.com>:
> Hello
>
> On 12/1/08, dave <at> whitevine.net <dave <at> whitevine.net> wrote:
>> The only non-standard thing about it is that it calls mmap(), which
>> I'm not sure is available on Windows. This should be fairly easy to
>> hook in to an equivalent call on any platform though.
>>
>> Other than that it should be completely portable to any C99 platform.
>
> I have read that Boost [1] also has a memory pool library
> (boost::pool) that even provides a std::allocator interface, as far as
> 1.33.0 goes. I haven't used it, and the documentation does not give me
> a clue about its portability, but I guess that it wouldn't be in Boost
> in the first place, if it wasn't broadly portable.
I've used Boost pools before. They're quite nice and is memory efficient.
However, it would be quite difficult for us to use. We can't really
use the allocator interface easily because, (1) it only works for STL
containers that use allocators, not for other sources of memory use;
(2) we'd have to go through and modify all of our STL containers to
use this allocator instead of the default one. This is quite an
intrusive and annoying change to make.
Calling the pools from malloc() itself isn't really possible, because
when free() is called, we wouldn't be able to efficiently tell where
the memory came from.
(Continue reading)