summaryrefslogtreecommitdiff
path: root/mysys/lf_alloc-pin.c
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-03-21 11:54:45 +0100
committerSergei Golubchik <serg@mariadb.org>2016-03-21 11:54:45 +0100
commit98ea8062075f027561488bf0f6c6e3aaf217249e (patch)
tree79d66dc1069035013222bea9cb5ada925291b522 /mysys/lf_alloc-pin.c
parentb9e571882b3801f53d30bb77155743af39c1b719 (diff)
parent11b77e9b18a8d97063b4c4a96e40bf9c75bd0e8b (diff)
downloadmariadb-git-98ea8062075f027561488bf0f6c6e3aaf217249e.tar.gz
Merge branch '5.5' into 10.0
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 b599b455ff5..282433ea48d 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);
@@ -349,7 +355,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);