First attempt at implementing an Allocation pool

Now we just need to work out what to do in the three callbacks
depends on #951
Same reformatting as in the cpp file.