1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Support memsize of AST

This commit is contained in:
Nobuyoshi Nakada 2019-07-23 16:18:40 +09:00
parent 90c4bd2d2b
commit 33f54da15b
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

9
ast.c
View file

@ -22,9 +22,16 @@ node_gc_mark(void *ptr)
rb_gc_mark((VALUE)data->ast);
}
static size_t
node_memsize(const void *ptr)
{
struct ASTNodeData *data = (struct ASTNodeData *)ptr;
return rb_ast_memsize(data->ast);
}
static const rb_data_type_t rb_node_type = {
"AST/node",
{node_gc_mark, RUBY_TYPED_DEFAULT_FREE, 0,},
{node_gc_mark, RUBY_TYPED_DEFAULT_FREE, node_memsize,},
0, 0,
RUBY_TYPED_FREE_IMMEDIATELY,
};