Forum

TextureArray and TextureSpread Renderer MemoryLeak

Hello,

Unless this is a normal behavior, changing texture count makes the memory to keep growing, I tried this with an LFO and Random to change the count every second (see simple attached patch)

And that’s also the case if TextureSize change.

In TaskManager VVVV’s memory usage keeps going up and is never released, even if nodes are deleted or reset.

vvvv_50beta38.1_x64
DX11 pack Version 1.3.1

TextureArray.v4p (4.2 KB)

As a work around suggested by @microdee setting all the TextureArray renderer with a fixed ElementCount helped.

Now in @vux DX11 contributions code, DX11Resources are supposed to be .Dispose() when some input pin change.

       public void Evaluate(int SpreadMax)
        {
            this.spmax = SpreadMax;
            this.rendereddevices.Clear();
            this.updateddevices.Clear();

            if (this.FOutTexture[0] == null) { this.FOutTexture[0] = new DX11Resource<DX11RenderTextureArray>(); }
            if (this.FOutDepthTexture[0] == null) { this.FOutDepthTexture[0] = new DX11Resource<DX11DepthTextureArray>(); }


            if (this.FInFormat.IsChanged
                || this.FInSize.IsChanged
                || this.FInElementCount.IsChanged
                || this.FInMips.IsChanged
                || this.FInAllowUAV.IsChanged
                || this.depthformatpin.IsChanged)
            {
                this.FOutTexture[0].Dispose();
                this.FOutDepthTexture[0].Dispose();

                this.FOutSliceTextures.SliceCount = this.FInElementCount[0];

                for (int i = 0; i < this.FInElementCount[0]; i++)
                {
                    this.FOutSliceTextures[i] = new DX11Resource<DX11Texture2D>();
                }
            }
        }

Now I think the Dispose methods is called correctly but maybe not doing the job. This should apparently Clear() all resources.

public void Dispose()
        {
            lock (syncRoot)
            {
                //Dispose resource for all devices
                foreach (DX11RenderContext context in this.resources.Keys)
                {
                    if (resources[context] is IDisposable)
                    {
                        IDisposable d = resources[context] as IDisposable;
                        d.Dispose();
                    }
                    //resources[dev].Dispose();
                }
                resources.Clear();
            }
        }

Perhaps a similar problem as this one (which was fixed)?

Anyway while having a non-dynamic ElementCount is performance wise a better things I imagine, is it a bad practice to have it dynamic anyway ?

Do you DX11 headz know if resizing a TextureArray at runtime is usually not recommended.

Thank you

in traditional programs it’s just harder to develop, because you need to destroy then create a new resource again if you need to “resize” as you can see.

is that code your suggestion or what is there?

The code above is from @vux 's github. I thought there would be something happening with Dispose methods being not called, similar to what happened before with DX11 Effect.
Apparently it is not the problem. So I’m still wondering if this issue is “by design” or an actual bug.