better loader_params memory management