*fixed a memory leak when applying GC on a forked environment.

This commit is contained in:
Wang Renxin 2017-05-24 18:49:17 +08:00
parent c2376228e1
commit 6088d98714
2 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,6 @@
May. 24 2017
Fixed a memory leak when applying GC on a forked environment
May. 20 2017
Improved stability by preventing assigning builtin boolean
@ -5,7 +8,7 @@ May. 18 2017
Fixed some memory potential leak when popped unexpected type of argument
May. 17 2017
Fixed a forked structure disposing issue if error occurs
Fixed a forked environment disposing issue if error occurs
May. 15 2017
Added mb_get_gc_enabled and mb_set_gc_enabled functions

View File

@ -6538,11 +6538,19 @@ static void _gc_try_trigger(mb_interpreter_t* s) {
/* Collect all garbage */
static void _gc_collect_garbage(mb_interpreter_t* s, int depth) {
#ifdef MB_ENABLE_FORK
mb_interpreter_t* src = 0;
#endif /* MB_ENABLE_FORK */
_ht_node_t* valid = 0;
_gc_t* gc = 0;
mb_assert(s);
#ifdef MB_ENABLE_FORK
while(mb_get_forked_from(s, &src) == MB_FUNC_OK)
s = src;
#endif /* MB_ENABLE_FORK */
gc = &s->gc;
/* Check whether it's paused */