summaryrefslogtreecommitdiff
path: root/sql/sp_rcontext.h
diff options
context:
space:
mode:
authorunknown <pem@mysql.comhem.se>2005-05-23 23:43:43 +0200
committerunknown <pem@mysql.comhem.se>2005-05-23 23:43:43 +0200
commitc6f2053acdbfc9942412ebd8d7f5f3553750d47b (patch)
tree616f85ace18874855d5ab3b1a193fe32e82e096a /sql/sp_rcontext.h
parent0768ab1d2dbd568021ad17f49aadfd4d18dae82f (diff)
downloadmariadb-git-c6f2053acdbfc9942412ebd8d7f5f3553750d47b.tar.gz
Fixed on BUG#6048: Stored procedure causes operating system reboot
Memory leak in locally evalutated expressions during SP execution fixed by reusing allocated item slots when possible. Note: No test case added, since the test is a stress test that tries to make the machine to run out of memory. Second attempt, now tested with debug build, valgrind build, max (optimized) build, with and without --debug, --vagrind and --ps-protocol. Errors in trigger and view test with --debug in debug build where present before this patch, and likewise for valgrind warnings for view test in valgrind build with --ps-protocol. sql/item.cc: Init rsize in Item (for SP item reusal). sql/item.h: Addes special new operator for reuse of Items, for SP internal use only. sql/sp_head.cc: Reuse items assigned internally in SPs when possible. sql/sp_rcontext.cc: Reuse items assigned internally in SPs when possible. Moved the local variable assignment here (from sp_head) to avoid duplicated code. sql/sp_rcontext.h: New arg to sp_rcontext::set_item_eval() (and some coding style). sql/sql_class.cc: Adjusted call to new set_item_eval().
Diffstat (limited to 'sql/sp_rcontext.h')
-rw-r--r--sql/sp_rcontext.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h
index c132032e32c..417c50d0f0f 100644
--- a/sql/sp_rcontext.h
+++ b/sql/sp_rcontext.h
@@ -62,19 +62,19 @@ class sp_rcontext : public Sql_alloc
push_item(Item *i)
{
if (m_count < m_fsize)
- m_frame[m_count++] = i;
+ m_frame[m_count++]= i;
}
inline void
set_item(uint idx, Item *i)
{
if (idx < m_count)
- m_frame[idx] = i;
+ m_frame[idx]= i;
}
/* Returns 0 on success, -1 on (eval) failure */
int
- set_item_eval(uint idx, Item **i, enum_field_types type);
+ set_item_eval(THD *thd, uint idx, Item **i, enum_field_types type);
inline Item *
get_item(uint idx)
@@ -82,7 +82,6 @@ class sp_rcontext : public Sql_alloc
return m_frame[idx];
}
-
inline Item **
get_item_addr(uint idx)
{