When is a custom op destroyed

When I make a custom op in tensorrt, in the preparation phase I see it is created initialized and terminated then destroyed a few times. However, sometimes I notice that it is terminated without being created, only initialized.

When could this happen? I guess I’d appreciate any additional information on the respective roles of terminate and destroy. Say my custom op requires a bunch of auxiliary data structures on the GPU. Should they be destroyed during terminate, or destroy?

I tried to have them destroyed during terminate, but sometimes this results in tensorrt trying to destroy things that hasn’t been created yet.

Request you to share your code so that we can reproduce the issue along with the system and platform info.
Also if possible, please share with the vebose log, so that we can help you better.