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:
		
							parent
							
								
									90c4bd2d2b
								
							
						
					
					
						commit
						33f54da15b
					
				
					 1 changed files with 8 additions and 1 deletions
				
			
		
							
								
								
									
										9
									
								
								ast.c
									
										
									
									
									
								
							
							
						
						
									
										9
									
								
								ast.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -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,
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue