Use hash map in flatten_bvh
use Dict in alloc records