diff options
author | Alexander Barkov <bar@mariadb.com> | 2018-06-28 16:55:42 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2018-06-28 16:55:42 +0400 |
commit | 724a5105cba31fe48bd0a2754d074d8942b21153 (patch) | |
tree | ce032fcc6a755ed17768ba8cf457e5196942391e /sql/sp_head.h | |
parent | 445339feac2b9f0164870b3c90b20b2075d117bb (diff) | |
download | mariadb-git-724a5105cba31fe48bd0a2754d074d8942b21153.tar.gz |
MDEV-16584 SP with a cursor inside a loop wastes THD memory aggressively
Problem:
push_handler() created sp_handler_entry instances on THD::main_mem_root,
which is freed only after the SP instructions execution.
So in case of a CONTINUE HANDLER inside a loop (e.g. WHILE) this approach
leaked thread memory on every loop iteration.
Changes:
- Removing sp_handler_entry declaration, it's not really needed.
- Fixing the data type of sp_rcontext::m_handlers from
Dynamic_array<sp_handler_entry*> to Dynamic_array<sp_instr_hpush_jump*>
- Fixing sp_rcontext::push_handler() to push the pointer to
an sp_instr_hpush_jump instance to the handler stack.
This instance contains everything we need.
There is no a need to allocate anything else.
Diffstat (limited to 'sql/sp_head.h')
-rw-r--r-- | sql/sp_head.h | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/sql/sp_head.h b/sql/sp_head.h index 580859b8831..cf934603cf0 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -1677,8 +1677,6 @@ public: { return m_handler; } private: - -private: /// Handler. sp_handler *m_handler; |