We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f3a258c commit a499a0aCopy full SHA for a499a0a
perception/autoware_tensorrt_classifier/src/tensorrt_classifier.cpp
@@ -193,9 +193,15 @@ TrtClassifier::TrtClassifier(
193
194
TrtClassifier::~TrtClassifier()
195
{
196
- if (m_cuda) {
197
- if (h_img_) CHECK_CUDA_ERROR(cudaFreeHost(h_img_));
198
- if (d_img_) CHECK_CUDA_ERROR(cudaFree(d_img_));
+ try {
+ if (m_cuda) {
+ if (h_img_) CHECK_CUDA_ERROR(cudaFreeHost(h_img_));
199
+ if (d_img_) CHECK_CUDA_ERROR(cudaFree(d_img_));
200
+ }
201
+ } catch (const std::exception & e) {
202
+ std::cerr << "Exception in TrtClassifier destructor: " << e.what() << std::endl;
203
+ } catch (...) {
204
+ std::cerr << "Unknown exception in TrtClassifier destructor" << std::endl;
205
}
206
207
0 commit comments