Memory leak detection in class NvDecoder

I’m exploring the decoding examples, and after playing around and building some test app on top of the APIs I found myself having memory leaks (nothing major but still). Using VC I managed to locate to source of the leak targeting me to the line:
p_var = new = new NvDecoder(cu_context, width, height, true, cudaVideoCodec_HEVC, NULL, true);
However, I do not know how it is possible for me to dig deeper and figure out where exactly it goes wrong inside of this class.

A few possible causes for the leak which I could think of are:

  • I’m using the DecodeLockFrame function, however, as far as I know I release all locked frames. Is there away to confirm there are no lock frames before I destroy the object? (will these frames even show up as a memory leak given that they are gpu memory?)
  • As being done by the example I do not destroy the cuda context (cuCtxDestroy) when finishing with the object and deleting it, I did try to do so but it caused a crash.

Any thoughts/suggestions?