Finish #4: limit GPU memory usage