Memory leak creating nvinfer1::IRuntime


I used a sanitizer to analyze the memory usage of my app and discovered a memory leak occurring when invoking the createInferRuntime function. I have created a simple demo to replicate the memory leak. Could you please assist me in confirming whether I am using it incorrectly or if there is a bug present?


TensorRT Version: 8600
GPU Type: GTX-2080
Nvidia Driver Version: 510.47.03
CUDA Version: 11.6
CUDNN Version: 8.4.1
Operating System + Version: Ubuntu 18.04

Relevant Files

#include "NvInfer.h"
#include "NvInferRuntimeCommon.h"
#include <memory>

class Logger : public nvinfer1::ILogger {
  explicit Logger(Severity severity = Severity::kWARNING)
      : reportable_severity(severity) {}

  void log(Severity severity, const char *msg) noexcept override {}

  Severity reportable_severity;

int main(int argc, char *argv[]) {
  Logger logger;
  auto runtime_ =
  return 0;


cmake_minimum_required(VERSION 3.10)

    "--std=c++17 -Wno-unused-variable -Wno-unused-function -Wno-unused-parameter -Wno-deprecated-declarations -g -fsanitize=address"
list(APPEND LIBRARIES nvinfer)

# Add the executable target

# Link against the required libraries
target_link_libraries(leak_test ${LIBRARIES})

Steps To Reproduce

  • mkdir build && cd build
  • cmake ..
  • make
  • ./leak_test

Will report memory leak like this:

==19489==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f83585762cb bp 0x7ffe5e3a7a70 sp 0x7ffe5e3a7a50 T0)
==19489==The signal is caused by a READ memory access.
==19489==Hint: address points to the zero page.
    #0 0x7f83585762cb in createInferRuntime_INTERNAL (/usr/lib/x86_64-linux-gnu/
    #1 0x55f8044cb0c1 in createInferRuntime /usr/include/x86_64-linux-gnu/NvInferRuntime.h:3653
    #2 0x55f8044cb187 in main /usr/src/tensorrt/samples/leak_test/
    #3 0x7f83563b8c86 in __libc_start_main (/lib/x86_64-linux-gnu/
    #4 0x55f8044cafe9 in _start (/usr/src/tensorrt/samples/leak_test/build/leak_test+0xfe9)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/usr/lib/x86_64-linux-gnu/ in createInferRuntime_INTERNAL

Request you to share the ONNX model and the script if not shared already so that we can assist you better.
Alongside you can try few things:

  1. validating your model with the below snippet

import sys
import onnx
filename = yourONNXmodel
model = onnx.load(filename)
2) Try running your model with trtexec command.

In case you are still facing issue, request you to share the trtexec “”–verbose"" log for further debugging

Thanks for your response.

This thread was deprecated because of the incorrect description. I didn’t find the entrance to delete this post except to flag this post to the maintainers.

For developers reading this post, I have posted a new thread - Memory leak creating nvinfer1::IRuntime on Jetson Orin - Jetson & Embedded Systems / Jetson Orin NX - NVIDIA Developer Forums