ruby-changes:56625
From: Nobuyoshi <ko1@a...>
Date: Tue, 23 Jul 2019 16:26:41 +0900 (JST)
Subject: [ruby-changes:56625] Nobuyoshi Nakada: 33f54da15b (master): Support memsize of AST
https://git.ruby-lang.org/ruby.git/commit/?id=33f54da15b From 33f54da15ba137fc1569016f5caa492c1a57eb4d Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Tue, 23 Jul 2019 16:18:40 +0900 Subject: Support memsize of AST diff --git a/ast.c b/ast.c index a1af214..4c6477d 100644 --- a/ast.c +++ b/ast.c @@ -22,9 +22,16 @@ node_gc_mark(void *ptr) https://github.com/ruby/ruby/blob/trunk/ast.c#L22 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, }; -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/