Skip to content

Commit

Permalink
Add REF_STACK_RESERVE constant
Browse files Browse the repository at this point in the history
  • Loading branch information
khvzak committed Feb 2, 2024
1 parent 908f376 commit 3014c4d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lua.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ pub(crate) static EXTRA_REGISTRY_KEY: u8 = 0;

const WRAPPED_FAILURE_POOL_SIZE: usize = 64;
const MULTIVALUE_POOL_SIZE: usize = 64;
const REF_STACK_RESERVE: c_int = 1;

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

0 comments on commit 3014c4d

Please sign in to comment.