Use NVidia to process GPU decode, Repeatedly placing memory will cause program crash

SDK version : cuda_9.2.88_windows
Testing environment: GTX 1060 6G x 1 , windows 8.1 x64 8G RAM

Compile SDK into win32 and run the sample video for 100 times,
Continuously placing memory which leads to H.265 codec crashed eventually.

Sample code and sample test file in the link below.
** Had tested Intel On-board driver but didn’t see above issue occurred.

http://ftp.geovision.tw/FTP/AndyChen/Nvidia.zip

There are issues in your code:

  1. Your file specifies the input file as plush1_720p_10s.m2v but you gave us H265.bin (which is an HEVC elementary file).

  2. I’m not sure why you turn off g_bUseInterop but it doesn’t matter for my experiment I describe below.

  3. You hack g_nWindowWidth to 320 and g_nWindowHeight to 240 but your source file is 1920 x 1080.

  4. There seems no apparent reason for the changes around renderVideoFrame(hWnd, g_bUseInterop).

  5. The main problem is the placement of your x100 loop. It apparently does not cleanly initialize and deinitialize everything. I haven’t studied it in detail to identify what you have missed but I did an experiment to prove that it must be the case and that NVDec is not the problem here. Bear in mind that this application is designed to run once. If you want to modify that, you’ll have to carefully check everything, not just add a quick hack and hope it is OK.

Here is my experiment. Minimally change the original SDK code to decode your H265.bin. Build the app. Run it and see that it works fine. Then open a CMD window and run this:

FOR /L %%A IN (1,1,100) DO (
cudaDecodeD3D9.exe
)

This runs and completes 100 times without crashing, which excludes any issues with NVDec. It’s up to you to try to find a proper way to loop within the code if you really need that. You haven’t told us the reason for this looping you want to do.

Hi,
I have tried CMD it was OK for runnig 100 times, But it was always close and open program process.
Because I want to run 100 times at a program process, and never close process.
I have modified my sample code, but it still crashed eventually, When running 83 times it always crash at
CUresult oResult = cuvidCreateVideoParser(&hParser_, &oVideoParserParameters);
My CMD is "cudaDecodeD3D9.exe -decodecuda i H265.bin "

https://mega.nz/#!HdgGmSaZ!woNDfyGCjIo7fBcgqRQIVDUKTGZ85Y06xT-uMqQwWMI

Thank your help

Actually the application has an option to do the looping (g_bLoop) but it needs to be changed to loop only a fixed number of times rather than forever, and some other code changes to work correctly. I also suppressed the window creation when g_bUseInterop is false. Here are the changes I made to get it working. The variable repeat_count specifies how many times you’d like to run. This runs and completes 100 times without crashing.

http://rationalqm.us/misc/GeoVision.rar

Hi
I have tried your sample code, but it still crashed at “CUresult oResult = cuvidCreateVideoParser(&hParser_, &oVideoParserParameters);” when running 84 times.
My CMD still is "cudaDecodeD3D9.exe -decodecuda i H265.bin "
Compilling platform is vs2010 Release Win32 .
Testing environment: " Intel® Core™i5-4590 CPU, GTX 1060 6G x 1 , windows 8.1 x64 8G RAM "
Thank your help

That’s very strange. I ran it with repeat_count=1000 and it succeeded on my 1080 Ti. Monitoring the memory usage did not show any steady increase.

What return code are you getting from cuvidCreateVideoParser()?

Hi,
I could not get return code because it was crashed inside “cuvidCreateVideoParser” function and the “hParser” was NULL.
I have snapshotted a picture and the link is https://mega.nz/#!CMoxyKaR!iBff1iMC2JQwA0Xe31Kruw0EJTYiJ1Cqfp9-j8YGrvQ.
By the way could you test " GTX 1060 6G " and trying whether it will crash when running 100 times.
thank your help

If cuvidCreateVideoParser() did not return only nVidia can help you.

Sorry, I do not have a GTX 1060. I will test it on my 1050 and report back.

I tested on my 1050 Ti and it is running fine.

The only question I have is that you said you “Compile SDK into win32”, but the sample does not have a Win32 configuration in the project. Did you add one? If so, maybe you didn’t do that correctly. Have you tried running with the x64 configuration?

Also, what nVidia driver version do you have? I have tested on 397.55 and 397.64.

Hi

  1. I have added one Win32 platform.
  2. I had rebuilt to x64 platform, but it still crashed when running about 1094 times.
  3. My nVidia driver version is 397.44
    thank your help

The only thing left is for you to try upgrading to the latest nVidia driver version. If that doesn’t resolve it, then you’ll have to submit an nVidia bug report about it.