Error [defaultAllocator.cpp::deallocate::35] Error Code 1: Cuda Runtime (invalid argument)

Hi
I have converted yolov5s.pt file into yolov5s.wts and then build the engine file yolov5s.engine. I have modified some parts of the code from here Jetson/L4T/TRT Customized Example - eLinux.org and some code taken from this repo tensorrtx/yolov5_det_trt.py at master · wang-xinyu/tensorrtx · GitHub . Everything is working fine but when I close the window by pressing Esc, it closes with error msg:

[03/30/2023-19:08:59] [TRT] [E] 1: [defaultAllocator.cpp::deallocate::35] Error Code 1: Cuda Runtime (invalid argument)

Tensor rt version: 8.2.1.8
Board Type: Jetson Nano
Cuda: 10.2.300
Jetpack: 4.6.1

I have uploaded my project here: test.zip - Google Drive
with all the files. Please if anyone can suggest what is the issue? Thanks

Hi,

This is related to the destructor of TensorRT.
Could you try to unset the engine variable to see if it helps?

engine = []

Thanks.

Hi @AastaLLL
Where exactly I have to put this in code I shared?
I created another function in the class YoloV5TRT

def Destroy(self):
   self.engine = []

and called this outside of while display.IsStreaming(): so that once application closes, self.engine = [] is called but still getting the same error.

Thanks

Hi, @AastaLLL is there any update on this, please? Thanks

Solved it by moving the below variable outside of the class

host_inputs
cuda_inputs
host_outputs
cuda_outputs
bindings

Hi,

Sorry for the late reply.
Thanks for the update and good to know it works now.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.