From 10a368d35a3a1de4e6db8c1892e17bf1b653bfc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 6 Oct 2023 08:19:20 +0300 Subject: [PATCH] Fix GCC 13.2.0 -Wmismatched-new-delete Table_cache_instance::operator new[](size_t): Reverted the changes that were made in commit 8edef482a790cf684602e52800361567cb3d65a1 and move them to the only caller. --- sql/table_cache.cc | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/sql/table_cache.cc b/sql/table_cache.cc index e454444032e..0039c96a001 100644 --- a/sql/table_cache.cc +++ b/sql/table_cache.cc @@ -149,15 +149,7 @@ struct Table_cache_instance } static void *operator new[](size_t size) - { - void *res= aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE); - if (res) - { - tc_allocated_size= size; - update_malloc_size(size, 0); - } - return res; - } + { return aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE); } static void operator delete[](void *ptr) { aligned_free(ptr); } static void mark_memory_freed() { @@ -614,6 +606,8 @@ bool tdc_init(void) /* Extra instance is allocated to avoid false sharing */ if (!(tc= new Table_cache_instance[tc_instances + 1])) DBUG_RETURN(true); + tc_allocated_size= (tc_instances + 1) * sizeof *tc; + update_malloc_size(tc_allocated_size, 0); tdc_inited= true; mysql_mutex_init(key_LOCK_unused_shares, &LOCK_unused_shares, MY_MUTEX_INIT_FAST);