C:\source\rtSafe\safeRuntime.cpp (32) - Cuda Error in nvinfer1::internal::DefaultAllocator::free: 1 (invalid argument)

Description

TensorRT 8.0 and C++ (cuda 11.3) can work in my environment normally.
When I use mex to convert c++ function to matlab function and use TensorRT 8.0 and MatlabR2021a (cuda 11.3) , It will report this bug : C:\source\rtSafe\safeRuntime.cpp (32) - Cuda Error in nvinfer1::internal::DefaultAllocator::free: 1 (invalid argument).
However TensorRT 7.2.1 and Matlab R2021a (cuda11.0) will not report this bug. I don’t know whether Matlab R2021a does not support TensorRT Version 8.0.1.6.And I don’t know the meaning of this bug. Looking forward to your answer.

Environment

TensorRT Version: 8.0.1.6
GPU Type: GTX3090
CUDA Version: 11.3
CUDNN Version: 8.2.1
MatlabR2021a
Operating System + Version: WINDOW10

@1047792668,

Could you please share us complete error logs and minimal issue repro script/model along with steps to reproduce the issue for better debugging.

Thank you.

But this is the complete error logs T_T. I use mex to convert c++ function (contain TensorRT module) to matlab function and get this mexw64 file. When I use Matlab2021a call this function cwin, it will report this bug.
cwin.mexw64 (39 KB)

Got similar error, but under different circumstances. I link my c++ project against TensorRT-7.2.3.4. The error occurs in ICudaEnginge::destroy(), after a call to cudaDeviceReset(). Removing unnecessary cudaDeviceReset() solved the problem in my case. Hope this helps.

Thank you for your advice! But it can not work T_T.

@1047792668,

Looks like you’ve shared binary file. We recommend you to please share issue repro script and model for better debugging.