Fix ANSOCR TensorRT Release
This commit is contained in:
@@ -150,6 +150,18 @@ public:
|
||||
|
||||
private:
|
||||
TRTEngineCache() = default;
|
||||
~TRTEngineCache() {
|
||||
if (g_processExiting().load(std::memory_order_relaxed)) {
|
||||
// ExitProcess path: CUDA context is dead. Leak ICudaEngine and
|
||||
// IRuntime shared_ptrs so their destructors don't call into a
|
||||
// destroyed CUDA driver. The OS reclaims everything at exit.
|
||||
for (auto& [_, entry] : m_cache) {
|
||||
auto* le = new std::shared_ptr<nvinfer1::ICudaEngine>(std::move(entry.engine));
|
||||
auto* lr = new std::shared_ptr<nvinfer1::IRuntime>(std::move(entry.runtime));
|
||||
(void)le; (void)lr; // intentional leak
|
||||
}
|
||||
}
|
||||
}
|
||||
TRTEngineCache(const TRTEngineCache&) = delete;
|
||||
TRTEngineCache& operator=(const TRTEngineCache&) = delete;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user