fix: 修复 Python TensorRT 资源释放

- 移除不存在的 .destroy() 方法调用
- Python TensorRT 由 GC 管理,= None 即释放
This commit is contained in:
2026-01-30 10:39:02 +08:00
parent bcabe65984
commit b67bda8042

View File

@@ -331,19 +331,18 @@ class TensorRTEngine:
return {"total_mb": 0, "used_mb": 0, "free_mb": 0}
def _release_resources(self):
"""释放资源"""
"""释放资源Python TensorRT 由 GC 管理,无需 destroy"""
if self._stream:
try:
self._stream.synchronize()
except Exception:
pass
self._stream = None
if self._context:
self._context.destroy()
self._context = None
if self._engine:
self._engine.destroy()
self._engine = None
self._memory_pool.clear()