Allocation caching, plus fix for CachingAllocator

Allocations are now cached globally between frameworks and for all
allocations.