Handle leak in std::thread c++

Viewed 216

today I noticed a strange think when using std::thread. This is minimal test case:

void test() 
{
    std::thread t1([] {}); 
    t1.join();
}

Every time I run this code, one Handle leaked.

This is a view from ProcessExplorer. These leaked handles are thread mutexes "BaseNammedObjects\bx_thread_mutex"

enter image description here

These mutexes are not released anytime future. Is this some know issue?

I'm using latest Visual Studio 2019 16.7.3 and I'm testing it on 32bit app (debug and release too).

Edited:

Leaked handles are liner to number of execution, so this snippet:

for (int n = 0; n < 1000; n++)
{
    std::thread t1([] {});
    t1.join();
}

creates 1000 leaked handles: enter image description here

1 Answers

Sorry for the semi-false alarm.

The issue seems to be caused by 3rd party plugin Deleaker (I'm just testing now) used for memory leak detection (funny, right? ;-) ).

When I disable this plugin, everything works ok. So it's something that Deleaker does inside. I will report this issue to the author.

Edit: It seems that the latest version of Deleaker fixes this issue.

enter image description here

Related