Skip to content

Commit

Permalink
don't alloca more than one page in apply()
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Mar 11, 2014
1 parent 83ccf97 commit ff2f6a1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ JL_CALLABLE(jl_f_typeassert)
}

static jl_function_t *jl_append_any_func;
extern size_t jl_page_size;

JL_CALLABLE(jl_f_apply)
{
Expand Down Expand Up @@ -295,7 +296,7 @@ JL_CALLABLE(jl_f_apply)
return result;
}
}
if (n > 64000) {
if (n > jl_page_size/sizeof(jl_value_t*)) {
// put arguments on the heap if there are too many
argarr = (jl_value_t*)jl_alloc_cell_1d(n);
newargs = jl_cell_data(argarr);
Expand Down

0 comments on commit ff2f6a1

Please sign in to comment.