Re-add support for custom allocators

--HG--
extra : amend_source : 472f1f7117ee5f7306583b320a60407c29992012