Hi!
"Sergey" == Sergey Petrunya <psergey@askmonty.org> writes:
Sergey> Hi Kristian, Sergey> On Tue, Mar 09, 2010 at 04:11:26PM +0100, Kristian Nielsen wrote:
Thanks for offering to help with the memory leak. Here are the details.
Tree is here:
lp:~maria-captains/maria/mariadb-5.1-knielsen
This tree is the merge with MySQL-5.1.44, including your fix for the uninitialised variable in table elimination.
The test case is the following, which is a simplified version of main.union (so main.union shows the same memory leak):
-------------------------------- cut here -------------------------------- CREATE TABLE t1 (a VARCHAR(10), FULLTEXT KEY a (a)); INSERT INTO t1 VALUES (1),(2); CREATE TABLE t2 (b INT); INSERT INTO t2 VALUES (1),(2);
EXPLAIN EXTENDED SELECT * FROM t1 UNION SELECT * FROM t1 ORDER BY (SELECT a FROM t2 WHERE b = 12);
DROP TABLE t1,t2; -------------------------------- cut here --------------------------------
<cut> Sergey> subselect_single_select_engine::prepare(). Sergey> === modified file 'sql/item_subselect.cc' Sergey> --- a/sql/item_subselect.cc 2010-03-09 15:03:54 +0000 Sergey> +++ b/sql/item_subselect.cc 2010-03-09 18:53:56 +0000 Sergey> @@ -1776,6 +1776,10 @@ Sergey> { Sergey> if (prepared) Sergey> return 0; Sergey> + if (select_lex->join) Sergey> + { Sergey> + select_lex->cleanup(); Sergey> + } Sergey> join= new JOIN(thd, select_lex->item_list, Sergey> select_lex->options | SELECT_NO_UNLOCK, result); Sergey> if (!join || !result) Sanja, as you know the code, could you please verify the above bug fix? Regards, Monty