TensorRT-Alpha icon indicating copy to clipboard operation
TensorRT-Alpha copied to clipboard

warning:[E] [TRT] 3: [runtime.cpp::~Runtime::346] Error Code 3: API Usage Error (Parameter check failed at: runtime/rt/runtime.cpp::~Runtime::346, condition: mEngineCounter.use_count() == 1. Destroying a runtime before destroying deserialized engines created by the runtime leads to undefined behavior.

Open FeiYull opened this issue 1 year ago • 3 comments

warning:[E] [TRT] 3: [runtime.cpp::~Runtime::346] Error Code 3: API Usage Error (Parameter check failed at: runtime/rt/runtime.cpp::~Runtime::346, condition: mEngineCounter.use_count() == 1. Destroying a runtime before destroying deserialized engines created by the runtime leads to undefined behavior.

38D1385F1608CCB649091E16D74CE69E

[solution]:eg: 更换声明下面runtime变量到新的位置

runtime原始声明位置: https://github.com/FeiYull/TensorRT-Alpha/blob/87fdb72056682835ab06e417f7d51f483e197ebf/yolov8/yolov8.cpp#L19

runtime新的原始声明位置: https://github.com/FeiYull/TensorRT-Alpha/blob/87fdb72056682835ab06e417f7d51f483e197ebf/utils/yolo.h#L26

FeiYull avatar Feb 28 '24 08:02 FeiYull

reference: https://github.com/FeiYull/TensorRT-Alpha/issues/91#issuecomment-1970319941

FeiYull @.***

------------------ Original ------------------ From: Myreaeee @.> Date: Thu,Mar 7,2024 5:21 PM To: FeiYull/TensorRT-Alpha @.> Cc: FeiYull @.>, Author @.> Subject: Re: [FeiYull/TensorRT-Alpha] warning:[E] [TRT] 3:[runtime.cpp::~Runtime::346] Error Code 3: API Usage Error (Parameter checkfailed at: runtime/rt/runtime.cpp::~Runtime::346, condition:mEngineCounter.use_count() == 1. Destroying a runtime before destroyingdeserialized engines created by the runtime leads to undefined behavior.(Issue #90)

i have added codes in yolo.h, why it still didnot work protected: std::unique_ptrnvinfer1::IRuntime runtime; std::shared_ptrnvinfer1::ICudaEngine m_engine; std::unique_ptrnvinfer1::IExecutionContext m_context; protected:
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

FeiYull avatar Mar 07 '24 10:03 FeiYull

你好,可以解释一下报错的原因吗,而且解决的思路

NGIWS719 avatar Jul 25 '24 03:07 NGIWS719

你好,可以解释一下报错的原因吗,而且解决的思路 报错原因应该是你在创建完engine后,runtime释放掉了,但不能这样;还有就是在调用析构函数时,先声明的后释放,所以在声明时runtime变量得在engine前。 具体可以看下这个,https://blog.csdn.net/qq_42190134/article/details/135365945

DCC-lzhy avatar Aug 09 '24 02:08 DCC-lzhy