aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lstate.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lstate.js b/src/lstate.js
index 664ef27..020971a 100644
--- a/src/lstate.js
+++ b/src/lstate.js
@@ -75,6 +75,11 @@ class global_State {
}
+const luaE_freeCI = function(L) {
+ let ci = L.ci;
+ ci.next = null;
+};
+
const stack_init = function(L1, L) {
L1.stack = new Array(BASIC_STACK_SIZE); // TODO: for now we don't care about the stack size
L1.top = 0;
@@ -88,6 +93,12 @@ const stack_init = function(L1, L) {
L1.ci = ci;
};
+const freestack = function(L) {
+ L.ci = L.base_ci;
+ luaE_freeCI(L);
+ L.stack = null;
+};
+
/*
** Create registry table and its predefined values
*/
@@ -158,6 +169,7 @@ const lua_newstate = function() {
const close_state = function(L) {
lfunc.luaF_close(L, L.stack); /* close all upvalues for this thread */
+ freestack(L);
};
const lua_close = function(L) {