1 (edited by fieldskyleb 23-07-2020 04:22:23)

Topic: NVOF Memory Leak when the number of CPU threads are less than three

I found that NVOF has a memory leak when the Number of CPU threads is set to less than three.

When set to less than three CPU threads, SVP will function properly for a few minutes, and then the screen will start having green flashes until avisynth crashes.

The memory leak still happens even when 1. the total prefetch frames are higher than three and 2. the CPU threads are still less than three (i.e. ff_add=4 and threads=2).

I updated Avisynth to 3.6.1, and it still had the same memory leak.

I use SVP with a capture card, so I am always looking for a way to reduce latency. As a result, I try to keep my prefetched frames at a minimum. As a result, the lowest possible would be 3 prefetched frames because of three cpu threads. 

From what I can tell the NVOF implementation requires a minimum of three cpu threads to operate. But I found a way to lower the number of prefetched frames in avisynth while still giving NVOF at least three threads.

Warning: Don't do this unless you know what you're doing. Likewise, I'm not using resize, colorspace conversion, or any other avisynth features. I'm also using a capture card that the video stream is in RAW. And I use a light, but very fast, renderer. So this is VERY limited.

I modified the generate.js and set a specific prefetch number. I also kept the CPU threads higher than three.

No memory leak, no green flashes, and I've been able to reduce may total input latency to less than 35ms.

Edit: Don't set the prefetch too low or you'll get some strange audio distortions.

Re: NVOF Memory Leak when the number of CPU threads are less than three

Sorry, I can't check this in the following two weeks cause I'm on vacation.

However in my own tests Avisynth 3.6.x seems broken - don't use it!
https://github.com/AviSynth/AviSynthPlus/issues/178

Re: NVOF Memory Leak when the number of CPU threads are less than three

Both 3.5.1 and 3.6.1 have the same NVOF memory leak when the CPU threads are set to less than three. Notably, setting the prefetch in generate.js and setting threads to at least 3 will stop the memory leak in both versions.

With 3.6.1, when I set the prefetch to 1 (threads=3), I get audio distortions. With 3.5.1, the audio works fine with the prefetch set to 1 (threads=3).

In comparing 3.5.1 and 3.6.1, I found that 3.6.1 uses more ram...

Re: NVOF Memory Leak when the number of CPU threads are less than three

Prefetch(N) --> N _is_ the number of threads. Don't set "threads" and prefetch() arg to different values!

> I found that NVOF has a memory leak when the Number of CPU threads is set to less than three.

Yep, it looks like a bug. Will be fixed in the next build.

Re: NVOF Memory Leak when the number of CPU threads are less than three

Try this (put in /plugins64)

Post's attachments

svpflow1.dll 433 kb, 236 downloads since 2020-08-25 

svpflow2.dll 468 kb, 222 downloads since 2020-08-25 

Re: NVOF Memory Leak when the number of CPU threads are less than three

It is working great.

I tested it with the CPU thread at 1, and I made sure that prefetch was set to "threads" in the generate.js. The memory usage was stable, and the audio was working well.

Chainik: Thank you for fixing this.