pool allocator algorithm