8000 [PRISM] Fix memory leak of ST table · ruby/ruby@947194a · GitHub
[go: up one dir, main page]

Skip to content

Commit 947194a

Browse files
committed
[PRISM] Fix memory leak of ST table
This commit fixes a memory leak in rb_translate_prism because the ST table is never freed. There are still more memory leaks which still need to be fixed. For example: 10.times do 100_000.times do RubyVM::InstructionSequence.compile_prism("") end puts `ps -o rss= -p #{$$}` end Before: 34544 57120 79360 102176 123712 146320 168192 190592 212192 234896 After: 18336 24592 31488 37648 44592 50944 57280 63632 69904 76160
1 parent 78ad91f commit 947194a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

prism_compile.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6936,6 +6936,8 @@ rb_translate_prism(pm_parser_t *parser, rb_iseq_t *iseq, pm_scope_node_t *scope_
69366936
pm_compile_node(iseq, (pm_node_t *)scope_node, ret, scope_node->base.location.start, false, (pm_scope_node_t *)scope_node);
69376937
iseq_set_sequence(iseq, ret);
69386938

6939+
st_free_table(index_lookup_table);
6940+
69396941
return Qnil;
69406942
}
69416943

0 commit comments

Comments
 (0)
0