TensorRT Engine Creation from Caffe Model Fails When Run Consecutively

I have an application which creates TensorRT engine from caffemodel and several engines are created from different caffemodels on this application. Now when I just create a single engine, everything is fine and the engine is created. But when I try to consecutively create two different engines (not at the same time), after the first engine is created, application throws segmentation fault when trying to create the second engine.

I use sample::getEngine function to create the engine. But it seems that the function throws segmentation fault without giving any proper log for this case. The part where it throws the segmentation fault seems to be the snippet below.

const auto blobNameToTensor = parser.caffeParser->parse(
            model.prototxt.c_str(), modelName.empty() ? nullptr : modelName.c_str(), network, DataType::kFLOAT);

Environment

TensorRT Version: TensorRT-7.1.3.4
GPU Type: Quadro P4000
Nvidia Driver Version: 455.32.00
CUDA Version: 10.2

Relevant Files

Hi,
UFF and Caffe Parser have been deprecated from TensorRT 7 onwards, hence request you to try ONNX parser.
Please check the below link for the same.

Thanks!

I followed your suggestion and it worked smoothly. Thanks!