Skip to content

Commit 10a368d

Browse files
committed
Fix GCC 13.2.0 -Wmismatched-new-delete
Table_cache_instance::operator new[](size_t): Reverted the changes that were made in commit 8edef48 and move them to the only caller.
1 parent 9e62ab7 commit 10a368d

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

sql/table_cache.cc

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,7 @@ struct Table_cache_instance
149149
}
150150

151151
static void *operator new[](size_t size)
152-
{
153-
void *res= aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE);
154-
if (res)
155-
{
156-
tc_allocated_size= size;
157-
update_malloc_size(size, 0);
158-
}
159-
return res;
160-
}
152+
{ return aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE); }
161153
static void operator delete[](void *ptr) { aligned_free(ptr); }
162154
static void mark_memory_freed()
163155
{
@@ -614,6 +606,8 @@ bool tdc_init(void)
614606
/* Extra instance is allocated to avoid false sharing */
615607
if (!(tc= new Table_cache_instance[tc_instances + 1]))
616608
DBUG_RETURN(true);
609+
tc_allocated_size= (tc_instances + 1) * sizeof *tc;
610+
update_malloc_size(tc_allocated_size, 0);
617611
tdc_inited= true;
618612
mysql_mutex_init(key_LOCK_unused_shares, &LOCK_unused_shares,
619613
MY_MUTEX_INIT_FAST);

0 commit comments

Comments
 (0)