Add allocateInGen() for allocating in a specific generation, and cleanups