Segmentation fault (core dumped)

I customize a plugin named “detectOutPut” and use the existing plugins from TensorRT 5.0.

I do it just as following:

// create pluginfactory

nvinfer1::IPlugin* PluginFactory::createPlugin(const char* layerName, const nvinfer1::Weights* weights, int nbWeights)
{

createPlugin();

}

// do it
main.cpp

initLibNvInferPlugins(&gLogger.getTRTLogger(), “”);

parser->setPluginFactoryExt(pluginFactory);

engine = builder->buildCudaEngine(*network);

it run inoto " Segmentation fault (core dumped) "

does I do it right ? if not, how should I do. can you give me some samples for this case.