scummvm/scummvm — pull request #116 by lordhoto (2011-11-13 01:44:38+00:00)
Title: Adding support for custom allocators in our containers

IMPORTANT: This is a pull request to make people aware of this and for feedback purposes and not for it to be merged without any prior discussion (with me).

As the name said this pull request adds support for custom allocators for our container classes. The main idea behind it was to allow HashMap to use both pool based allocation and non-pool based allocation, since for small HashMaps the default pool size might be quite an overhead.

This patch also touches Array (and takes the opportunity to implement a better object construction/destruction scheme in Common::Array, which should help with non-POD data types) and List, which might benefit for a pool based allocator in some use cases to help with memory fragmentation or similar.

This patch might add overhead, even when the compiler inlines all the allocator routines into the container classes. Thus one of the outstanding TODOs is to check whether and how it affects binary size and/or run time memory usage. Another thing to check would be: Do we actually need this?

I am happy to hear feedback from you guys.