Commit 702f4efc authored by Sergei Petrunia's avatar Sergei Petrunia

More "straightforward" memory management

Do not put Histogram objects on MEM_ROOT at all
parent 28ad1285
...@@ -1238,6 +1238,8 @@ class Column_stat: public Stat_table ...@@ -1238,6 +1238,8 @@ class Column_stat: public Stat_table
table_field->read_stats->histogram= hist; table_field->read_stats->histogram= hist;
return hist; return hist;
} }
else
delete hist;
} }
return NULL; return NULL;
} }
...@@ -1647,10 +1649,10 @@ Histogram_base *create_histogram(MEM_ROOT *mem_root, Histogram_type hist_type, ...@@ -1647,10 +1649,10 @@ Histogram_base *create_histogram(MEM_ROOT *mem_root, Histogram_type hist_type,
switch (hist_type) { switch (hist_type) {
case SINGLE_PREC_HB: case SINGLE_PREC_HB:
case DOUBLE_PREC_HB: case DOUBLE_PREC_HB:
res= new (mem_root) Histogram_binary(); res= new Histogram_binary();
break; break;
case JSON_HB: case JSON_HB:
res= new (mem_root) Histogram_json_hb(); res= new Histogram_json_hb();
break; break;
default: default:
DBUG_ASSERT(0); DBUG_ASSERT(0);
......
...@@ -151,7 +151,7 @@ class Histogram_builder; ...@@ -151,7 +151,7 @@ class Histogram_builder;
/* /*
Common base for all histograms Common base for all histograms
*/ */
class Histogram_base : public Sql_alloc class Histogram_base
{ {
public: public:
virtual bool parse(MEM_ROOT *mem_root, Field *field, Histogram_type type_arg, virtual bool parse(MEM_ROOT *mem_root, Field *field, Histogram_type type_arg,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment