Skip to content

Commit 3014c4d

Browse files
committed
Add REF_STACK_RESERVE constant
1 parent 908f376 commit 3014c4d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/lua.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ pub(crate) static EXTRA_REGISTRY_KEY: u8 = 0;
226226

227227
const WRAPPED_FAILURE_POOL_SIZE: usize = 64;
228228
const MULTIVALUE_POOL_SIZE: usize = 64;
229+
const REF_STACK_RESERVE: c_int = 1;
229230

230231
/// Requires `feature = "send"`
231232
#[cfg(feature = "send")]
@@ -519,8 +520,8 @@ impl Lua {
519520
#[cfg(feature = "module")]
520521
skip_memory_check: false,
521522
ref_thread,
522-
// We need 1 extra stack space to move values in and out of the ref stack.
523-
ref_stack_size: ffi::LUA_MINSTACK - 1,
523+
// We need some reserved stack space to move values in and out of the ref stack.
524+
ref_stack_size: ffi::LUA_MINSTACK - REF_STACK_RESERVE,
524525
ref_stack_top: ffi::lua_gettop(ref_thread),
525526
ref_free: Vec::new(),
526527
wrapped_failure_pool: Vec::with_capacity(WRAPPED_FAILURE_POOL_SIZE),

0 commit comments

Comments
 (0)