SharpDX.WPF Increasing memory usage during rendering

Jan 14, 2015 at 8:42 PM

I have implemented simple application with this library. It depends on tutorial:
My renderer with IDirect3D interface implements only two methods: Reset and RenderScene. Additionaly I have Vertex and Pixel shaders to render simple lines with DirectX3D. Data to GPU is passed by SharpDX.Direct3D10.Buffer and its change each frame.

My problem is that memory increasing all time. Slowly but all time. I have only one WPF control with one Renderer.

I have question: Is it problem with DirectX in WPF; Should I use this library in another way?
Is that possible that something additional is created in each frame?

I have newest SharpDX library from Nuget.

Methods implementation:
    public override void Reset(DrawEventArgs args)
        if (args.RenderSize.Width == 0) return;

        _drawArgs = args;

        _controlInfoConstantBuffer.Value = new ControlParamsShaderData
            SamplesInControl = dataLength,
            MinSignalDataY = -1500,
            MaxSignalDataY = 1500

        Device.VertexShader.SetConstantBuffer(0, _controlInfoConstantBuffer.Buffer);
Even if I remove implementation of RenderScene method, memory increase.
    public override void RenderScene(DrawEventArgs args)
        if (args.RenderSize.Width == 0) return;

        Device.ClearRenderTargetView(RenderTargetView, Color.Transparent);

        using (var stream = _graphDataVertexBuffer.Map(MapMode.WriteDiscard, SharpDX.Direct3D10.MapFlags.None))
            for (int i = 0; i < Data.Length; i++)
                stream.Write(new Vector3(i, Data[i], 0));
        Device.Draw(Data.Length, 0);
Init Vertex buffer code looks like that:
        var sizeInBytes = dataLength * sizeof(int) * 3;
        var bufferDescription = new BufferDescription(

        using (var stream = new DataStream(sizeInBytes, true, true))
            stream.Position = 0;
            _graphDataVertexBuffer = new SharpDX.Direct3D10.Buffer(Device, stream, bufferDescription);

        Device.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(_graphDataVertexBuffer, sizeof(int) * 3, 0));
        Device.InputAssembler.PrimitiveTopology = PrimitiveTopology.LineStrip;
Render scene method is called by DispatcherTimer in equal intervals.

I can upload my code if you want to debug.
thanks for help!