move snapshot to subprocess to save memory