Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/lgc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1624,12 +1624,16 @@ void luaC_inherit_thread(lua_State *L, lua_State *th)
{
int i;
GCheader *steal, *tmp;
thr_State *pt;

if (th->heap == NULL) {
// already done
return;
}

pt = luaC_get_per_thread(L);
block_collector(L, pt);

Comment thread
cursor[bot] marked this conversation as resolved.
Comment thread
balupillai marked this conversation as resolved.
/* when a thread is reclaimed, the executing thread
* needs to steal its contents */
lock_all_threads();
Expand Down Expand Up @@ -1673,6 +1677,8 @@ void luaC_inherit_thread(lua_State *L, lua_State *th)
TAILQ_REMOVE(&G(L)->all_heaps, th->heap, heaps);
unlock_all_threads();

unblock_collector(L, pt);

free(th->heap);
th->heap = NULL;

Expand Down