refactor to include on-heap management in allocators, support heap allocator, and auto meteredflusher