SFML community forums

Help => Graphics => Topic started by: Tima32 on October 15, 2018, 12:07:59 am

Title: Memory leak when loading textures in multi-thread
Post by: Tima32 on October 15, 2018, 12:07:59 am
There is a memory leak:
void _1()
{
        Texture t_up;
        t_up.loadFromFile(String(L"GUI\\Textures\\Up.png"));
}

while (1)
        {
                Thread t(&_1);
                t.launch();
                t.wait();
        }
 

No memory leaks:
void _1()
{
        Texture t_up;
        t_up.loadFromFile(String(L"GUI\\Textures\\Up.png"));
}

while (1)
        {
                _1();
        }

How to load textures in a multi-thread and not get memory leaks?
SFML 2.5.0 Visual Studio 15
Title: Re: Memory leak when loading textures in multi-thread
Post by: Tima32 on October 15, 2018, 12:25:57 am
If you repeat the above with RenderWindov there will be a memory leak.