summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2020-08-10 18:03:05 +0000
committerVladislav Vaintroub <wlad@mariadb.com>2020-08-10 18:03:05 +0000
commit78ea8ad425f2dc650b07e33d4724bbb21a9d1f17 (patch)
tree6ee62f6717bfd07354fa448cd9ce1f994ab396c1
parent3b6dadb5ebedab71bf1870579745ff3cd05e498a (diff)
downloadmariadb-git-78ea8ad425f2dc650b07e33d4724bbb21a9d1f17.tar.gz
MDEV-23378 - fix an alleged memory "leak" in threadpool.
Implement a workaround to shut the "memory not freed" message.
-rw-r--r--sql/threadpool_generic.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/sql/threadpool_generic.cc b/sql/threadpool_generic.cc
index 02eb336facb..78b57340a6b 100644
--- a/sql/threadpool_generic.cc
+++ b/sql/threadpool_generic.cc
@@ -1084,7 +1084,10 @@ void thread_group_destroy(thread_group_t *thread_group)
#endif
if (my_atomic_add32(&shutdown_group_count, -1) == 1)
+ {
my_free(all_groups);
+ all_groups= 0;
+ }
}
/**
@@ -1677,6 +1680,14 @@ TP_pool_generic::~TP_pool_generic()
{
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;
DBUG_VOID_RETURN;
}