Implement new "flat" and "classbased" automatic allocation modes