Commit 78ea8ad4 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-23378 - fix an alleged memory "leak" in threadpool.

Implement a workaround to shut the "memory not freed" message.
parent 3b6dadb5
...@@ -1084,7 +1084,10 @@ void thread_group_destroy(thread_group_t *thread_group) ...@@ -1084,7 +1084,10 @@ void thread_group_destroy(thread_group_t *thread_group)
#endif #endif
if (my_atomic_add32(&shutdown_group_count, -1) == 1) if (my_atomic_add32(&shutdown_group_count, -1) == 1)
{
my_free(all_groups); my_free(all_groups);
all_groups= 0;
}
} }
/** /**
...@@ -1677,6 +1680,14 @@ TP_pool_generic::~TP_pool_generic() ...@@ -1677,6 +1680,14 @@ TP_pool_generic::~TP_pool_generic()
{ {
thread_group_close(&all_groups[i]); thread_group_close(&all_groups[i]);
} }
/*
Wait until memory occupied by all_groups is freed.
*/
int timeout_ms=5000;
while(all_groups && timeout_ms--)
my_sleep(1000);
threadpool_started= false; threadpool_started= false;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment