-
Dmitry Shulga authored
MDEV-33769: Memory leak found in the test main.rownum run with --ps-protocol against a server built with the option -DWITH_PROTECT_STATEMENT_MEMROOT A memory leak happens on the second execution of a query that run in PS mode and uses the function ROWNUM(). A memory leak took place on allocation of an instance of the class Item_int for storing a limit value that is performed at the function set_limit_for_unit indirectly called from JOIN::optimize_inner. Typical trace to the place where the memory leak occurred is below: JOIN::optimize_inner optimize_rownum process_direct_rownum_comparison set_limit_for_unit new (thd->mem_root) Item_int(thd, lim, MAX_BIGINT_WIDTH); To fix this memory leak, calling of the function optimize_rownum() has to be performed only once on first execution and never called after that. To control it, the new data member first_rownum_optimization added into the structure st_select_lex.
5e6c1224