diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index b2317761d08..b253ba048b2 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -6097,7 +6097,7 @@ bool Item_func_like::find_selective_predicates_list_processor(void *arg) THD *thd= data->table->in_use; COND_STATISTIC *stat; Item *arg0; - if (!(stat= thd->alloc(1))) + if (!(stat= new (thd) COND_STATISTIC())) return TRUE; stat->cond= this; arg0= args[0]->real_item(); diff --git a/sql/item_func.cc b/sql/item_func.cc index 06b5cf416dd..cf16c357762 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -82,7 +82,7 @@ static inline bool test_if_sum_overflows_ull(ulonglong arg1, ulonglong arg2) /** - Allocate memory for arguments using tmp_args or thd->alloc(). + Allocate memory for arguments using tmp_args or new (thd) Item*[]. @retval false - success @retval true - error (arg_count is set to 0 for conveniece) */ @@ -2832,7 +2832,7 @@ bool Item_func_rand::fix_fields(THD *thd,Item **ref) ) ) || rand); if (!rand && - !(rand= thd->active_stmt_arena_to_use()->alloc(1))) + !(rand= new (thd->active_stmt_arena_to_use()) my_rnd_struct())) return TRUE; } else diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 7c35d8e8654..a0c758b2531 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -5398,7 +5398,7 @@ bool subselect_hash_sj_engine::make_semi_join_conds() if (!(semi_join_conds= new (thd) Item_cond_and(thd))) DBUG_RETURN(TRUE); - if (!(tmp_table_ref= thd->alloc(1))) + if (!(tmp_table_ref= new (thd) TABLE_LIST())) DBUG_RETURN(TRUE); table_name.str= tmp_table->alias.c_ptr(); @@ -5466,7 +5466,7 @@ subselect_hash_sj_engine::make_unique_engine() - here we initialize only those members that are used by subselect_uniquesubquery_engine, so these objects are incomplete. */ - if (!(tab= thd->alloc(1))) + if (!(tab= new (thd) JOIN_TAB())) DBUG_RETURN(NULL); tab->table= tmp_table; diff --git a/sql/opt_split.cc b/sql/opt_split.cc index c85b1a71333..55b0120394b 100644 --- a/sql/opt_split.cc +++ b/sql/opt_split.cc @@ -613,7 +613,7 @@ void TABLE::add_splitting_info_for_key_field(KEY_FIELD *key_field) } if (!eq_item) return; - KEY_FIELD *added_key_field= thd->alloc(1); + KEY_FIELD *added_key_field= new (thd) KEY_FIELD(); if (!added_key_field || spl_opt_info->added_key_fields.push_back(added_key_field,thd->mem_root)) return; @@ -1105,7 +1105,7 @@ SplM_plan_info * JOIN_TAB::choose_best_splitting(uint idx, key_map spl_keys= table->keys_usable_for_splitting; if (!(first_non_const_pos->key && spl_keys.is_set(first_non_const_pos->key->key)) || - !(spl_plan= thd->alloc(1)) || + !(spl_plan= new (thd) SplM_plan_info()) || !(spl_plan->best_positions= new (thd) POSITION[join->table_count]) || spl_opt_info->plan_cache.push_back(spl_plan)) { diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index 8656d8da413..3d8e84b7614 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -5176,7 +5176,7 @@ int init_dups_weedout(JOIN *join, uint first_table, int first_fanout_table, uint if (jt_rowid_offset) /* Temptable has at least one rowid */ { size_t ntabs= last_tab - sjtabs; - if (!(sjtbl= thd->alloc(1)) || + if (!(sjtbl= new (thd) SJ_TMP_TABLE()) || !(sjtbl->tabs= new (thd) SJ_TMP_TABLE::TAB[ntabs])) DBUG_RETURN(TRUE); /* purecov: inspected */ memcpy(sjtbl->tabs, sjtabs, ntabs * sizeof(SJ_TMP_TABLE::TAB)); @@ -5196,7 +5196,7 @@ int init_dups_weedout(JOIN *join, uint first_table, int first_fanout_table, uint not depend on anything at all, ie this is WHERE const IN (uncorrelated select) */ - if (!(sjtbl= thd->alloc(1))) + if (!(sjtbl= new (thd) SJ_TMP_TABLE())) DBUG_RETURN(TRUE); /* purecov: inspected */ sjtbl->tmp_table= NULL; sjtbl->is_degenerate= TRUE; diff --git a/sql/opt_table_elimination.cc b/sql/opt_table_elimination.cc index 24c8a6606da..411d216a7e3 100644 --- a/sql/opt_table_elimination.cc +++ b/sql/opt_table_elimination.cc @@ -1729,7 +1729,7 @@ void Dep_analysis_context::create_unique_pseudo_key_if_needed( auto max_possible_elements= first_select->join->fields_list.elements; void *buf; MY_BITMAP *exposed_fields= (MY_BITMAP*) - current_thd->alloc(1); + new (current_thd) MY_BITMAP(); if (!(buf= current_thd->alloc(bitmap_buffer_size(max_possible_elements))) || my_bitmap_init(exposed_fields, (my_bitmap_map*)buf, max_possible_elements)) diff --git a/sql/sp.cc b/sql/sp.cc index 3cf1dd5dd25..6b76d51d0f3 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -2409,7 +2409,7 @@ bool sp_add_used_routine(Query_tables_list *prelocking_ctx, Query_arena *arena, if (!my_hash_search(&prelocking_ctx->sroutines, key->ptr(), key->length())) { - Sroutine_hash_entry *rn= arena->alloc(1); + Sroutine_hash_entry *rn= new (arena) Sroutine_hash_entry(); if (unlikely(!rn)) // OOM. Error will be reported using fatal_error(). return FALSE; MDL_REQUEST_INIT_BY_KEY(&rn->mdl_request, key, MDL_SHARED, MDL_TRANSACTION); diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 273d265551a..d28ec825571 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -2573,7 +2573,7 @@ int sp_head::push_backpatch(THD *thd, sp_instr *i, sp_label *lab, List *list, backpatch_instr_type itype) { - bp_t *bp= thd->alloc(1); + bp_t *bp= new (thd) bp_t(); if (!bp) return 1; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 071eefda7bf..d128f8ae337 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -12044,7 +12044,7 @@ bool sp_grant_privileges(THD *thd, Lex_cstring_strlen sctx_user(sctx->priv_user); Lex_cstring_strlen sctx_host(sctx->priv_host); - if (!(combo= thd->alloc(1))) + if (!(combo= new (thd) LEX_USER())) DBUG_RETURN(TRUE); mysql_mutex_lock(&acl_cache->lock); diff --git a/sql/sql_alloc.h b/sql/sql_alloc.h index 73c5a405d07..526c23a1f63 100644 --- a/sql/sql_alloc.h +++ b/sql/sql_alloc.h @@ -49,10 +49,14 @@ public: }; void* operator new[](size_t size, const THD *thd) noexcept; +void* operator new(size_t size, const THD *thd) noexcept; void operator delete[](void *ptr, const THD *thd) noexcept; +void operator delete(void *ptr, const THD *thd) noexcept; class Query_arena; void* operator new[](size_t size, const Query_arena *thd) noexcept; +void* operator new(size_t size, const Query_arena *thd) noexcept; void operator delete[](void *ptr, const Query_arena *thd) noexcept; +void operator delete(void *ptr, const Query_arena *thd) noexcept; #endif /* SQL_ALLOC_INCLUDED */ diff --git a/sql/sql_base.cc b/sql/sql_base.cc index c330147c0dc..6622cf9f8ae 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -3394,7 +3394,7 @@ request_backoff_action(enum_open_table_action action_arg, { DBUG_ASSERT(action_arg == OT_DISCOVER || action_arg == OT_REPAIR || action_arg == OT_ADD_HISTORY_PARTITION); - m_failed_table= m_thd->alloc(1); + m_failed_table= new (m_thd) TABLE_LIST(); if (m_failed_table == NULL) return TRUE; m_failed_table->init_one_table(&table->db, &table->table_name, &table->alias, TL_WRITE); @@ -5000,7 +5000,7 @@ add_internal_tables(THD *thd, Query_tables_list *prelocking_ctx, continue; } - TABLE_LIST *tl= thd->alloc(1); + TABLE_LIST *tl= new (thd) TABLE_LIST(); if (!tl) DBUG_RETURN(TRUE); tl->init_one_table_for_prelocking(&tables->db, @@ -5075,7 +5075,7 @@ prepare_fk_prelocking_list(THD *thd, Query_tables_list *prelocking_ctx, &fk->foreign_db, &fk->foreign_table, lock_type)) continue; - TABLE_LIST *tl= thd->alloc(1); + TABLE_LIST *tl= new (thd) TABLE_LIST(); tl->init_one_table_for_prelocking(&fk->foreign_db, &fk->foreign_table, NULL, lock_type, TABLE_LIST::PRELOCK_FK, table_list->belong_to_view, op, &prelocking_ctx->query_tables_last, table_list->for_insert_data); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index aa31a9b335b..42eb7798f4c 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -5133,7 +5133,7 @@ TABLE *open_purge_table(THD *thd, const char *db, size_t dblen, /* Purge already hold the MDL for the table */ Open_table_context ot_ctx(thd, MYSQL_OPEN_HAS_MDL_LOCK); - TABLE_LIST *tl= thd->alloc(1); + TABLE_LIST *tl= new (thd) TABLE_LIST(); LEX_CSTRING db_name= {db, dblen }; LEX_CSTRING table_name= { tb, tblen }; @@ -8848,13 +8848,30 @@ void* operator new[](size_t size, const THD *thd) noexcept return alloc_root(thd->mem_root, size); } +void* operator new(size_t size, const THD *thd) noexcept +{ + return alloc_root(thd->mem_root, size); +} + void operator delete[](void *ptr, const THD *thd) noexcept {} +void operator delete(void *ptr, const THD *thd) noexcept +{} + + void* operator new[](size_t size, const Query_arena *thd) noexcept { return alloc_root(thd->mem_root, size); } +void* operator new(size_t size, const Query_arena *thd) noexcept +{ + return alloc_root(thd->mem_root, size); +} + void operator delete[](void *ptr, const Query_arena *thd) noexcept {} + +void operator delete(void *ptr, const Query_arena *thd) noexcept +{} diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 5be2efc9847..5f0afcf2c85 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -4862,10 +4862,7 @@ void st_select_lex::fix_prepare_information(THD *thd, Item **conds, if (group_list.first) { if (!group_list_ptrs) - { - void *mem= active_arena->alloc(1); - group_list_ptrs= new (mem) Group_list_ptrs(active_arena->mem_root); - } + group_list_ptrs= new (thd) Group_list_ptrs(active_arena->mem_root); group_list_ptrs->reserve(group_list.elements); for (ORDER *order= group_list.first; order; order= order->next) { diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 2bda0f75d72..3d4f983c6d5 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2275,7 +2275,7 @@ dispatch_command_return dispatch_command(enum enum_server_command command, THD * char buff[250]; uint buff_len= sizeof(buff); - if (!(current_global_status_var= thd->alloc(1))) + if (!(current_global_status_var= new (thd) STATUS_VAR())) break; general_log_print(thd, command, NullS); status_var_increment(thd->status_var.com_stat[SQLCOM_SHOW_STATUS]); @@ -8002,7 +8002,7 @@ bool add_to_list(THD *thd, SQL_I_List &list, Item *item,bool asc) { ORDER *order; DBUG_ENTER("add_to_list"); - if (unlikely(!(order= thd->alloc(1)))) + if (unlikely(!(order= new (thd) ORDER()))) DBUG_RETURN(1); order->item_ptr= item; order->item= &order->item_ptr; @@ -8128,12 +8128,11 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, } bool has_alias_ptr= alias != nullptr; - void *memregion= thd->alloc(sizeof(TABLE_LIST)); - TABLE_LIST *ptr= new (memregion) TABLE_LIST(thd, db, fqtn, alias_str, - has_alias_ptr, table, lock_type, - mdl_type, table_options, - info_schema, this, - index_hints_arg, option); + TABLE_LIST *ptr= new (thd) TABLE_LIST(thd, db, fqtn, alias_str, + has_alias_ptr, table, lock_type, + mdl_type, table_options, + info_schema, this, + index_hints_arg, option); if (!ptr->table_name.str) DBUG_RETURN(0); // EOM @@ -10005,7 +10004,7 @@ LEX_USER *create_default_definer(THD *thd, bool role) { LEX_USER *definer; - if (unlikely(!(definer= thd->alloc(1)))) + if (unlikely(!(definer= new (thd) LEX_USER()))) return 0; thd->get_definer(definer, role); @@ -10040,7 +10039,7 @@ LEX_USER *create_definer(THD *thd, LEX_CSTRING *user_name, /* Create and initialize. */ - if (unlikely(!(definer= thd->alloc(1)))) + if (unlikely(!(definer= new (thd) LEX_USER()))) return 0; definer->user= *user_name; diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc index d7ca5736065..c813f6579bb 100644 --- a/sql/sql_rename.cc +++ b/sql/sql_rename.cc @@ -509,7 +509,7 @@ rename_tables(THD *thd, TABLE_LIST *table_list, DDL_LOG_STATE *ddl_log_state, when only using temporary tables. We don't need the log as all temporary tables will disappear anyway in a crash. */ - TABLE_PAIR *pair= thd->alloc(1); + TABLE_PAIR *pair= new (thd) TABLE_PAIR(); if (! pair || tmp_tables.push_front(pair, thd->mem_root)) goto revert_rename; pair->from= ren_table; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 0501f5880a1..e9799a1d5f2 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3523,7 +3523,7 @@ setup_subq_exit: if (select_lex->have_window_funcs()) { - if (!(join_tab= thd->alloc(1))) + if (!(join_tab= new (thd) JOIN_TAB())) DBUG_RETURN(1); #ifndef DBUG_OFF dbug_join_tab_array_size= 1; @@ -13379,7 +13379,7 @@ static bool create_hj_key_for_table(JOIN *join, JOIN_TAB *join_tab, if (!key_parts) DBUG_RETURN(TRUE); /* This memory is allocated only once for the joined table join_tab */ - if (!(keyinfo= thd->alloc(1)) || + if (!(keyinfo= new (thd) KEY()) || !(key_part_info = new (thd) KEY_PART_INFO[key_parts])) DBUG_RETURN(TRUE); keyinfo->usable_key_parts= keyinfo->user_defined_key_parts = key_parts; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index f40477666ac..f443663df77 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -11100,7 +11100,7 @@ TABLE_LIST *get_trigger_table(THD *thd, const sp_name *trg_name) return NULL; /* We need to reset statement table list to be PS/SP friendly. */ - if (!(table= thd->alloc(1))) + if (!(table= new (thd) TABLE_LIST())) return NULL; db= thd->make_ident_opt_casedn(trg_name->m_db, lower_case_table_names); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 5846fde4e16..da89ce55cb4 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -18488,14 +18488,14 @@ xid: text_string { MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE); - if (unlikely(!(Lex->xid= thd->alloc(1)))) + if (unlikely(!(Lex->xid= new (thd) XID()))) MYSQL_YYABORT; Lex->xid->set(1L, $1->ptr(), $1->length(), 0, 0); } | text_string ',' text_string { MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE); - if (unlikely(!(Lex->xid= thd->alloc(1)))) + if (unlikely(!(Lex->xid= new (thd) XID()))) MYSQL_YYABORT; Lex->xid->set(1L, $1->ptr(), $1->length(), $3->ptr(), $3->length()); } @@ -18505,7 +18505,7 @@ xid: $3->length() <= MAXBQUALSIZE && $5 <= static_cast( std::numeric_limits::max())); - if (unlikely(!(Lex->xid= thd->alloc(1)))) + if (unlikely(!(Lex->xid= new (thd) XID()))) MYSQL_YYABORT; Lex->xid->set($5, $1->ptr(), $1->length(), $3->ptr(), $3->length()); } diff --git a/sql/sys_vars.inl b/sql/sys_vars.inl index fee715983d1..ba2d2db43a7 100644 --- a/sql/sys_vars.inl +++ b/sql/sys_vars.inl @@ -3007,7 +3007,7 @@ private: bool do_check(THD *thd, set_var *var) override { - Charset_collation_map_st *map= thd->alloc(1); + Charset_collation_map_st *map= new (thd) Charset_collation_map_st(); if (!map || charset_collation_map_from_item(map, var->value, thd->get_utf8_flag())) return true; diff --git a/sql/unireg.cc b/sql/unireg.cc index cce4500a145..b2b60f8ff0f 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -911,7 +911,7 @@ static bool pack_header(THD *thd, uchar *forminfo, */ uint count= field->typelib()->count; field->save_interval= field->typelib(); - field->set_typelib(tmpint= thd->alloc(1)); + field->set_typelib(tmpint= new (thd) TYPELIB()); *tmpint= *field->save_interval; tmpint->type_names= new (thd) const char*[count + 1]; tmpint->type_lengths= new (thd) uint[count + 1]; diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index aea4e35a8c7..a7cd5f921f6 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -1239,7 +1239,7 @@ int ha_maria::write_row(const uchar * buf) int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt) { int error, fatal_error; - HA_CHECK *param= thd->alloc(1); + HA_CHECK *param= new (thd) HA_CHECK(); MARIA_SHARE *share= file->s; const char *old_proc_info; TRN *old_trn= file->trn; @@ -1393,7 +1393,7 @@ int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt) int ha_maria::analyze(THD *thd, HA_CHECK_OPT * check_opt) { int error= 0; - HA_CHECK *param= thd->alloc(1); + HA_CHECK *param= new (thd) HA_CHECK(); MARIA_SHARE *share= file->s; const char *old_proc_info; @@ -1432,7 +1432,7 @@ int ha_maria::analyze(THD *thd, HA_CHECK_OPT * check_opt) int ha_maria::repair(THD * thd, HA_CHECK_OPT *check_opt) { int error; - HA_CHECK *param= thd->alloc(1); + HA_CHECK *param= new (thd) HA_CHECK(); ha_rows start_records; const char *old_proc_info; @@ -1519,7 +1519,7 @@ int ha_maria::repair(THD * thd, HA_CHECK_OPT *check_opt) int ha_maria::zerofill(THD * thd, HA_CHECK_OPT *check_opt) { int error; - HA_CHECK *param= thd->alloc(1); + HA_CHECK *param= new (thd) HA_CHECK(); TRN *old_trn; MARIA_SHARE *share= file->s; @@ -1558,7 +1558,7 @@ int ha_maria::zerofill(THD * thd, HA_CHECK_OPT *check_opt) int ha_maria::optimize(THD * thd, HA_CHECK_OPT *check_opt) { int error; - HA_CHECK *param= thd->alloc(1); + HA_CHECK *param= new (thd) HA_CHECK(); if (!file || !param) return HA_ADMIN_INTERNAL_ERROR; @@ -1921,7 +1921,7 @@ int ha_maria::preload_keys(THD * thd, HA_CHECK_OPT *check_opt) errmsg= buf; } - HA_CHECK *param= thd->alloc(1); + HA_CHECK *param= new (thd) HA_CHECK(); if (!param) return HA_ADMIN_INTERNAL_ERROR; @@ -2032,7 +2032,7 @@ int ha_maria::enable_indexes(key_map map, bool persist) else { THD *thd= table->in_use; - HA_CHECK *param= thd->alloc(1); + HA_CHECK *param= new (thd) HA_CHECK(); if (!param) return HA_ADMIN_INTERNAL_ERROR; diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index cf01b3ecc8e..17d4ea33dfd 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -1001,7 +1001,7 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt) { if (!file) return HA_ADMIN_INTERNAL_ERROR; int error; - HA_CHECK *param= thd->alloc(1); + HA_CHECK *param= new (thd) HA_CHECK(); MYISAM_SHARE* share = file->s; const char *old_proc_info=thd->proc_info; @@ -1111,7 +1111,7 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt) int ha_myisam::analyze(THD *thd, HA_CHECK_OPT* check_opt) { int error=0; - HA_CHECK *param= thd->alloc(1); + HA_CHECK *param= new (thd) HA_CHECK(); MYISAM_SHARE* share = file->s; if (!param) @@ -1150,7 +1150,7 @@ int ha_myisam::analyze(THD *thd, HA_CHECK_OPT* check_opt) int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt) { int error; - HA_CHECK *param= thd->alloc(1); + HA_CHECK *param= new (thd) HA_CHECK(); ha_rows start_records; if (!file || !param) return HA_ADMIN_INTERNAL_ERROR; @@ -1208,7 +1208,7 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt) int ha_myisam::optimize(THD* thd, HA_CHECK_OPT *check_opt) { int error; - HA_CHECK *param= thd->alloc(1); + HA_CHECK *param= new (thd) HA_CHECK(); if (!file || !param) return HA_ADMIN_INTERNAL_ERROR; @@ -1472,7 +1472,7 @@ int ha_myisam::assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt) if (error != HA_ADMIN_OK) { /* Send error to user */ - HA_CHECK *param= thd->alloc(1); + HA_CHECK *param= new (thd) HA_CHECK(); if (!param) return HA_ADMIN_INTERNAL_ERROR; @@ -1539,7 +1539,7 @@ int ha_myisam::preload_keys(THD* thd, HA_CHECK_OPT *check_opt) err: { - HA_CHECK *param= thd->alloc(1); + HA_CHECK *param= new (thd) HA_CHECK(); if (!param) return HA_ADMIN_INTERNAL_ERROR; myisamchk_init(param); @@ -1644,7 +1644,7 @@ int ha_myisam::enable_indexes(key_map map, bool persist) { THD *thd= table->in_use; int was_error= thd->is_error(); - HA_CHECK *param= thd->alloc(1); + HA_CHECK *param= new (thd) HA_CHECK(); const char *save_proc_info=thd->proc_info; if (!param) diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index d2f0932cff4..a725db4b238 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -462,7 +462,7 @@ int ha_myisammrg::add_children_list(void) LEX_CSTRING db; LEX_CSTRING table_name; - child_l= thd->alloc(1); + child_l= new (thd) TABLE_LIST(); db.str= (char*) thd->memdup(mrg_child_def->db.str, mrg_child_def->db.length+1); db.length= mrg_child_def->db.length; table_name.str= (char*) thd->memdup(mrg_child_def->name.str, diff --git a/storage/perfschema/table_global_status.cc b/storage/perfschema/table_global_status.cc index 796126478e0..41a15b9cd3f 100644 --- a/storage/perfschema/table_global_status.cc +++ b/storage/perfschema/table_global_status.cc @@ -109,8 +109,8 @@ int table_global_status::rnd_init(bool scan) If scan == true, then allocate a new context from mem_root and store in TLS. If scan == false, then restore from TLS. */ - m_context= current_thd->alloc(1); - new (m_context) table_global_status_context(status_version, !scan); + m_context= new (current_thd) table_global_status_context(status_version, + !scan); return 0; } diff --git a/storage/perfschema/table_session_status.cc b/storage/perfschema/table_session_status.cc index 8cdaae4426f..3f782eb7e8b 100644 --- a/storage/perfschema/table_session_status.cc +++ b/storage/perfschema/table_session_status.cc @@ -97,8 +97,8 @@ int table_session_status::rnd_init(bool scan) If scan == true, then allocate a new context from mem_root and store in TLS. If scan == false, then restore from TLS. */ - m_context= current_thd->alloc(1); - new (m_context) table_session_status_context(status_version, !scan); + m_context= new (current_thd) table_session_status_context(status_version, + !scan); return 0; } diff --git a/storage/perfschema/table_status_by_account.cc b/storage/perfschema/table_status_by_account.cc index 1f607a182a9..553e7776011 100644 --- a/storage/perfschema/table_status_by_account.cc +++ b/storage/perfschema/table_status_by_account.cc @@ -116,8 +116,8 @@ int table_status_by_account::rnd_init(bool scan) allocate a new context from mem_root and store in TLS. If scan == false, then restore from TLS. */ - m_context= current_thd->alloc(1); - new (m_context) table_status_by_account_context(status_version, !scan); + m_context= new (current_thd) table_status_by_account_context(status_version, + !scan); return 0; } diff --git a/storage/perfschema/table_status_by_host.cc b/storage/perfschema/table_status_by_host.cc index d34c45fc523..105954811b8 100644 --- a/storage/perfschema/table_status_by_host.cc +++ b/storage/perfschema/table_status_by_host.cc @@ -116,8 +116,8 @@ int table_status_by_host::rnd_init(bool scan) allocate a new context from mem_root and store in TLS. If scan == false, then restore from TLS. */ - m_context= current_thd->alloc(1); - new (m_context) table_status_by_host_context(status_version, !scan); + m_context= new (current_thd) table_status_by_host_context(status_version, + !scan); return 0; } diff --git a/storage/perfschema/table_status_by_thread.cc b/storage/perfschema/table_status_by_thread.cc index a9e70c51343..3a373cb0204 100644 --- a/storage/perfschema/table_status_by_thread.cc +++ b/storage/perfschema/table_status_by_thread.cc @@ -116,8 +116,8 @@ int table_status_by_thread::rnd_init(bool scan) allocate a new context from mem_root and store in TLS. If scan == false, then restore from TLS. */ - m_context= current_thd->alloc(1); - new (m_context) table_status_by_thread_context(status_version, !scan); + m_context= new (current_thd) table_status_by_thread_context(status_version, + !scan); return 0; } diff --git a/storage/perfschema/table_status_by_user.cc b/storage/perfschema/table_status_by_user.cc index 9699dfb3a1a..44684c5280f 100644 --- a/storage/perfschema/table_status_by_user.cc +++ b/storage/perfschema/table_status_by_user.cc @@ -117,8 +117,8 @@ int table_status_by_user::rnd_init(bool scan) allocate a new context from mem_root and store in TLS. If scan == false, then restore from TLS. */ - m_context= current_thd->alloc(1); - new (m_context) table_status_by_user_context(status_version, !scan); + m_context= new (current_thd) table_status_by_user_context(status_version, + !scan); return 0; }