Stage 2 of MDEV-6152:

- Added mem_root to all calls to new Item
- Added private method operator new(size_t size) to Item to ensure that
  we always use a mem_root when creating an item.

This saves use once call to current_thd per Item creation
This commit is contained in:
Monty 2015-08-20 15:24:13 +03:00 committed by Sergey Vojtovich
commit 1bae0d9e56
51 changed files with 1146 additions and 881 deletions

View file

@ -490,7 +490,7 @@ Item *Item_sum::get_tmp_table_item(THD *thd)
if (arg->type() == Item::FIELD_ITEM)
((Item_field*) arg)->field= result_field_tmp++;
else
sum_item->args[i]= new Item_field(thd, result_field_tmp++);
sum_item->args[i]= new (thd->mem_root) Item_field(thd, result_field_tmp++);
}
}
}
@ -610,6 +610,10 @@ void Item_sum::cleanup()
forced_const= FALSE;
}
Item *Item_sum::result_item(THD *thd, Field *field)
{
return new (thd->mem_root) Item_field(thd, field);
}
/**
Compare keys consisting of single field that cannot be compared as binary.
@ -1759,6 +1763,12 @@ Item *Item_sum_std::copy_or_same(THD* thd)
}
Item *Item_sum_std::result_item(THD *thd, Field *field)
{
return new (thd->mem_root) Item_std_field(thd, this);
}
/*
Variance
*/
@ -1989,6 +1999,11 @@ void Item_sum_variance::update_field()
}
Item *Item_sum_variance::result_item(THD *thd, Field *field)
{
return new (thd->mem_root) Item_variance_field(thd, this);
}
/* min & max */
void Item_sum_hybrid::clear()
@ -2477,6 +2492,12 @@ void Item_sum_avg::update_field()
}
Item *Item_sum_avg::result_item(THD *thd, Field *field)
{
return new (thd->mem_root) Item_avg_field(thd, hybrid_type, this);
}
void Item_sum_hybrid::update_field()
{
switch (hybrid_type) {