Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Memory leak when loading textures in multi-thread  (Read 2874 times)

0 Members and 1 Guest are viewing this topic.

Tima32

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • Email
Memory leak when loading textures in multi-thread
« 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

Tima32

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • Email
Re: Memory leak when loading textures in multi-thread
« Reply #1 on: October 15, 2018, 12:25:57 am »
If you repeat the above with RenderWindov there will be a memory leak.