Ruby  2.4.2p198(2017-09-14revision59899)
Data Structures | Functions | Variables
object_tracing.c File Reference
#include "internal.h"
#include "ruby/debug.h"
#include "objspace.h"
Include dependency graph for object_tracing.c:

Go to the source code of this file.

Data Structures

struct  traceobj_arg
 

Functions

static const char * make_unique_str (st_table *tbl, const char *str, long len)
 
static void delete_unique_str (st_table *tbl, const char *str)
 
static void newobj_i (VALUE tpval, void *data)
 
static void freeobj_i (VALUE tpval, void *data)
 
static int free_keys_i (st_data_t key, st_data_t value, void *data)
 
static int free_values_i (st_data_t key, st_data_t value, void *data)
 
static struct traceobj_argget_traceobj_arg (void)
 
static VALUE trace_object_allocations_start (VALUE self)
 
static VALUE trace_object_allocations_stop (VALUE self)
 
static VALUE trace_object_allocations_clear (VALUE self)
 
static VALUE trace_object_allocations (VALUE self)
 
int rb_bug_reporter_add (void(*func)(FILE *, void *), void *data)
 
static int object_allocations_reporter_i (st_data_t key, st_data_t val, st_data_t ptr)
 
static void object_allocations_reporter (FILE *out, void *ptr)
 
static VALUE trace_object_allocations_debug_start (VALUE self)
 
static struct allocation_infolookup_allocation_info (VALUE obj)
 
struct allocation_infoobjspace_lookup_allocation_info (VALUE obj)
 
static VALUE allocation_sourcefile (VALUE self, VALUE obj)
 
static VALUE allocation_sourceline (VALUE self, VALUE obj)
 
static VALUE allocation_class_path (VALUE self, VALUE obj)
 
static VALUE allocation_method_id (VALUE self, VALUE obj)
 
static VALUE allocation_generation (VALUE self, VALUE obj)
 
void Init_object_tracing (VALUE rb_mObjSpace)
 

Variables

static struct traceobj_argtmp_trace_arg
 
static int tmp_keep_remains
 
static int object_allocations_reporter_registered = 0
 

Function Documentation

◆ allocation_class_path()

static VALUE allocation_class_path ( VALUE  self,
VALUE  obj 
)
static

◆ allocation_generation()

static VALUE allocation_generation ( VALUE  self,
VALUE  obj 
)
static

Definition at line 462 of file object_tracing.c.

References allocation_info::generation, lookup_allocation_info(), Qnil, and SIZET2NUM.

Referenced by Init_object_tracing().

◆ allocation_method_id()

static VALUE allocation_method_id ( VALUE  self,
VALUE  obj 
)
static

Definition at line 430 of file object_tracing.c.

References lookup_allocation_info(), allocation_info::mid, and Qnil.

Referenced by Init_object_tracing().

◆ allocation_sourcefile()

static VALUE allocation_sourcefile ( VALUE  self,
VALUE  obj 
)
static

Definition at line 346 of file object_tracing.c.

References lookup_allocation_info(), allocation_info::path, Qnil, and rb_str_new2.

Referenced by Init_object_tracing().

◆ allocation_sourceline()

static VALUE allocation_sourceline ( VALUE  self,
VALUE  obj 
)
static

Definition at line 366 of file object_tracing.c.

References INT2FIX, allocation_info::line, lookup_allocation_info(), and Qnil.

Referenced by Init_object_tracing().

◆ delete_unique_str()

static void delete_unique_str ( st_table tbl,
const char *  str 
)
static

Definition at line 55 of file object_tracing.c.

References ruby_xfree(), st_data_t, st_delete, st_insert, and st_lookup.

Referenced by freeobj_i(), and newobj_i().

◆ free_keys_i()

static int free_keys_i ( st_data_t  key,
st_data_t  value,
void *  data 
)
static

Definition at line 133 of file object_tracing.c.

References ruby_xfree(), and ST_CONTINUE.

Referenced by trace_object_allocations_clear().

◆ free_values_i()

static int free_values_i ( st_data_t  key,
st_data_t  value,
void *  data 
)
static

Definition at line 140 of file object_tracing.c.

References ruby_xfree(), and ST_CONTINUE.

Referenced by trace_object_allocations_clear().

◆ freeobj_i()

static void freeobj_i ( VALUE  tpval,
void *  data 
)
static

◆ get_traceobj_arg()

static struct traceobj_arg* get_traceobj_arg ( void  )
static

◆ Init_object_tracing()

void Init_object_tracing ( VALUE  rb_mObjSpace)

◆ lookup_allocation_info()

static struct allocation_info* lookup_allocation_info ( VALUE  obj)
static

◆ make_unique_str()

static const char* make_unique_str ( st_table tbl,
const char *  str,
long  len 
)
static

Definition at line 31 of file object_tracing.c.

References len, NULL, result, ruby_xmalloc(), st_add_direct, st_data_t, st_get_key(), st_insert, and st_lookup.

Referenced by newobj_i().

◆ newobj_i()

static void newobj_i ( VALUE  tpval,
void *  data 
)
static

◆ object_allocations_reporter()

static void object_allocations_reporter ( FILE out,
void *  ptr 
)
static

◆ object_allocations_reporter_i()

static int object_allocations_reporter_i ( st_data_t  key,
st_data_t  val,
st_data_t  ptr 
)
static

◆ objspace_lookup_allocation_info()

struct allocation_info* objspace_lookup_allocation_info ( VALUE  obj)

Definition at line 333 of file object_tracing.c.

References lookup_allocation_info().

Referenced by dump_object().

◆ rb_bug_reporter_add()

int rb_bug_reporter_add ( void(*)(FILE *, void *)  func,
void *  data 
)

Definition at line 314 of file error.c.

Referenced by trace_object_allocations(), and trace_object_allocations_debug_start().

◆ trace_object_allocations()

static VALUE trace_object_allocations ( VALUE  self)
static

◆ trace_object_allocations_clear()

static VALUE trace_object_allocations_clear ( VALUE  self)
static

◆ trace_object_allocations_debug_start()

static VALUE trace_object_allocations_debug_start ( VALUE  self)
static

◆ trace_object_allocations_start()

static VALUE trace_object_allocations_start ( VALUE  self)
static

◆ trace_object_allocations_stop()

static VALUE trace_object_allocations_stop ( VALUE  self)
static

Variable Documentation

◆ object_allocations_reporter_registered

int object_allocations_reporter_registered = 0
static

Definition at line 276 of file object_tracing.c.

Referenced by trace_object_allocations_debug_start().

◆ tmp_keep_remains

int tmp_keep_remains
static

Definition at line 147 of file object_tracing.c.

Referenced by get_traceobj_arg(), and trace_object_allocations_debug_start().

◆ tmp_trace_arg

struct traceobj_arg* tmp_trace_arg
static

Definition at line 146 of file object_tracing.c.

Referenced by get_traceobj_arg().