Kode / Kinc

Modern low level game library and hardware abstraction.
http://kinc.tech
zlib License
517 stars 119 forks source link

[Direct3D12] Memory leak on window resize #810

Closed zshoals closed 11 months ago

zshoals commented 1 year ago

Describe the bug On the D3D12 backend, resizing the window either by grabbing the window border and moving it or repeatedly calling "kinc_window_resize(0, x, y)" results in increasing memory usage, at least according to task manager and my increasingly choking PC. If resized enough times, memory usage seems to ramp explosively. This doesn't occur on the D3D11 graphics backend.

To Reproduce Steps to reproduce the behavior: Grab something like https://github.com/Kinc-Samples/Texture-Kinc/tree/main, in texture.c include "kinc/window.h", and modify the update loop with something like:

    static bool resized = false;
    if (resized)
    {
        kinc_window_resize(0, 400, 400);
    }
    else
    {
        kinc_window_resize(0, 600, 600);
    }
    resized = !resized;

Expected behavior Mostly consistent memory usage that doesn't increase substantially

Screenshots 20mb to 2gigs after 10ish seconds of running the modified texture sample, ouch, my memory https://i.imgur.com/WfNcbk1.png

Execution Environment:

Additional context Don't leave your test program running too long :)