API for changing SHOW_FLATTEN_MODE
tests memory leak
simplify: use JobLauncher instead of manually breaking work in chunks