74newobj_i(
VALUE tpval,
void *data)
107 info->
path = path_cstr;
116freeobj_i(
VALUE tpval,
void *data)
155allocation_info_tracer_mark(
void *
ptr)
163allocation_info_tracer_free(
void *
ptr)
175allocation_info_tracer_memsize(
const void *
ptr)
179 size =
sizeof(*trace_arg);
188 VALUE allocated_object;
190 allocated_object = (
VALUE)value;
207allocation_info_tracer_compact(
void *
ptr)
218 "ObjectTracing/allocation_info_tracer",
220 allocation_info_tracer_mark,
221 allocation_info_tracer_free,
222 allocation_info_tracer_memsize,
223 allocation_info_tracer_compact,
230static int tmp_keep_remains;
233get_traceobj_arg(
void)
235 if (tmp_trace_arg == 0) {
246 return tmp_trace_arg;
256trace_object_allocations_start(
VALUE self)
285trace_object_allocations_stop(
VALUE self)
312trace_object_allocations_clear(
VALUE self)
356trace_object_allocations(
VALUE self)
358 trace_object_allocations_start(self);
363static int object_allocations_reporter_registered = 0;
372 fprintf(
out,
"-- %p (%s F: %p, ", (
void *)obj, info->
living ?
"live" :
"dead", (
void *)info->
flags);
374 else fprintf(
out,
"C: %p", (
void *)info->
klass);
386object_allocations_reporter(
FILE *
out,
void *
ptr)
388 fprintf(
out,
"== object_allocations_reporter: START\n");
392 fprintf(
out,
"== object_allocations_reporter: END\n");
396trace_object_allocations_debug_start(
VALUE self)
398 tmp_keep_remains = 1;
399 if (object_allocations_reporter_registered == 0) {
400 object_allocations_reporter_registered = 1;
404 return trace_object_allocations_start(self);
408lookup_allocation_info(
VALUE obj)
422 return lookup_allocation_info(obj);
437 if (info && info->
path) {
572 rb_define_module_function(rb_mObjSpace,
"trace_object_allocations_debug_start", trace_object_allocations_debug_start, 0);
#define rb_define_module_function(klass, mid, func, arity)
Defines klass#mid and makes it a module function.
VALUE rb_tracearg_object(rb_trace_arg_t *trace_arg)
VALUE rb_tracearg_defined_class(rb_trace_arg_t *trace_arg)
VALUE rb_tracepoint_new(VALUE target_thread_not_supported_yet, rb_event_flag_t events, void(*func)(VALUE, void *), void *data)
VALUE rb_tracepoint_disable(VALUE tpval)
VALUE rb_tracearg_path(rb_trace_arg_t *trace_arg)
VALUE rb_tracepoint_enable(VALUE tpval)
VALUE rb_tracearg_method_id(rb_trace_arg_t *trace_arg)
rb_trace_arg_t * rb_tracearg_from_tracepoint(VALUE tpval)
VALUE rb_tracearg_lineno(rb_trace_arg_t *trace_arg)
char str[HTML_ESCAPE_MAX_LEN+1]
#define RUBY_INTERNAL_EVENT_FREEOBJ
#define RUBY_INTERNAL_EVENT_NEWOBJ
#define RSTRING_LEN(string)
#define RSTRING_PTR(string)
void ruby_xfree(void *x)
Deallocates a storage instance.
VALUE rb_gc_location(VALUE value)
void rb_gc_mark(VALUE ptr)
void * ruby_xmalloc(size_t size)
Allocates a storage instance.
void rb_gc_register_mark_object(VALUE obj)
Inform the garbage collector that object is a live Ruby object that should not be moved.
VALUE rb_define_module(const char *name)
int rb_bug_reporter_add(void(*func)(FILE *, void *), void *data)
void rb_raise(VALUE exc, const char *fmt,...)
VALUE rb_ensure(VALUE(*b_proc)(VALUE), VALUE data1, VALUE(*e_proc)(VALUE), VALUE data2)
An equivalent to ensure clause.
VALUE rb_cObject
Object class.
VALUE rb_class_path_cached(VALUE)
void Init_object_tracing(VALUE rb_mObjSpace)
struct allocation_info * objspace_lookup_allocation_info(VALUE obj)
@ RUBY_TYPED_FREE_IMMEDIATELY
#define TypedData_Make_Struct(klass, type, data_type, sval)
#define st_foreach_with_replace
struct traceobj_arg * prev_traceobj_arg
void error(const char *msg)