diff options
author | Monty <monty@mariadb.org> | 2020-04-17 19:21:03 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2020-04-18 12:32:36 +0300 |
commit | 0bcb65d358087bf94e217254f812f913343a6f5d (patch) | |
tree | e24956a1aca590fc89d07848d98b67a8eddcac68 /sql/mysqld.cc | |
parent | 749b9887943dadbed027412a2d6df2ab6c5ee275 (diff) | |
download | mariadb-git-0bcb65d358087bf94e217254f812f913343a6f5d.tar.gz |
Don't write warning about uninitialized mutex if there is a memory leak
Part of:
MDEV-21056 Assertion `global_status_var.global_memory_used == 0'
failed upon shutdown after query with DEFAULT on a geometry
field
Fixed by changing the ASSERT for memory leaks to a printf() on
stderr. This has needed as all mutex in mysys has been deleted and we
can't call functions like my_open() anymore.
Also added printing of leaks if safemalloc is used (like we do in 10.5)
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r-- | sql/mysqld.cc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 83e93110ad1..9cc841be735 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2172,13 +2172,12 @@ static void mysqld_exit(int exit_code) shutdown_performance_schema(); // we do it as late as possible #endif set_malloc_size_cb(NULL); - if (opt_endinfo && global_status_var.global_memory_used) - fprintf(stderr, "Warning: Memory not freed: %ld\n", - (long) global_status_var.global_memory_used); - if (!opt_debugging && !my_disable_leak_check && exit_code == 0 && - debug_assert_on_not_freed_memory) + if (global_status_var.global_memory_used) { - DBUG_ASSERT(global_status_var.global_memory_used == 0); + fprintf(stderr, "Warning: Memory not freed: %lld\n", + (longlong) global_status_var.global_memory_used); + if (exit_code == 0) + SAFEMALLOC_REPORT_MEMORY(0); } cleanup_tls(); DBUG_LEAVE; |