Project

General

Profile

« Previous | Next » 

Revision e3bfd25b

Added by peterzhu2118 (Peter Zhu) over 1 year ago

Fix memory leak of rb_ast_t in parser

ast_alloc uses TypedData_Make_Struct, which allocates a rb_ast_t. But it
is overwritten when we set the DATA_PTR so the original memory is leaked.

For example:

10.times do 100_000.times do eval("") end puts `ps -o rss= -p #{$$}` end 

Before:

17328 20752 23664 28400 30656 34224 37424 40784 43328 46656 

After:

14320 14320 14320 14320 14320 14320 14320 14336 14336 14336