summaryrefslogtreecommitdiff
path: root/mysys/lf_alloc-pin.c
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-03-21 13:02:53 +0100
committerSergei Golubchik <serg@mariadb.org>2016-03-21 13:02:53 +0100
commit3b0c7ac1f9d64afc933ce0354037c709366b7dff (patch)
tree39cefed54f79f93f82e9c33a4e094270103bf137 /mysys/lf_alloc-pin.c
parente7cf898d6dc3dcac41f58db4761df3a6d1dffc03 (diff)
parent22ebf3cb456e0d8db295e7cc93f08e3d3ecfea47 (diff)
downloadmariadb-git-3b0c7ac1f9d64afc933ce0354037c709366b7dff.tar.gz
Merge branch '10.0' into 10.1
Diffstat (limited to 'mysys/lf_alloc-pin.c')
-rw-r--r--mysys/lf_alloc-pin.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/mysys/lf_alloc-pin.c b/mysys/lf_alloc-pin.c
index f8a15829fb1..b349ef88ed1 100644
--- a/mysys/lf_alloc-pin.c
+++ b/mysys/lf_alloc-pin.c
@@ -103,6 +103,12 @@
#include <my_sys.h>
#include <lf.h>
+/*
+ when using alloca() leave at least that many bytes of the stack -
+ for functions we might be calling from within this stack frame
+*/
+#define ALLOCA_SAFETY_MARGIN 8192
+
#define LF_PINBOX_MAX_PINS 65536
static void lf_pinbox_real_free(LF_PINS *pins);
@@ -345,7 +351,8 @@ static void lf_pinbox_real_free(LF_PINS *pins)
{
int alloca_size= sizeof(void *)*LF_PINBOX_PINS*npins;
/* create a sorted list of pinned addresses, to speed up searches */
- if (available_stack_size(&pinbox, *pins->stack_ends_here) > alloca_size)
+ if (available_stack_size(&pinbox, *pins->stack_ends_here) >
+ alloca_size + ALLOCA_SAFETY_MARGIN)
{
struct st_harvester hv;
addr= (void **) alloca(alloca_size);