void Init_liballocations()

in ext/liballocations/liballocations.c [170:192]


void Init_liballocations() {
    VALUE mAllocations = rb_define_module_under(rb_cObject, "Allocations");

    allocation_tracer = rb_tracepoint_new(Qnil, RUBY_INTERNAL_EVENT_NEWOBJ,
                                          newobj_callback, NULL);

    free_tracer = rb_tracepoint_new(Qnil, RUBY_INTERNAL_EVENT_FREEOBJ,
                                    freeobj_callback, NULL);

    id_enabled = rb_intern("enabled");

    rb_define_singleton_method(mAllocations, "to_hash", allocations_to_hash, 0);
    rb_define_singleton_method(mAllocations, "start", allocations_start, 0);
    rb_define_singleton_method(mAllocations, "stop", allocations_stop, 0);
    rb_define_singleton_method(mAllocations, "enabled?", allocations_enabled_p, 0);

    rb_define_const(mAllocations, "ALLOCATION_TRACER", allocation_tracer);
    rb_define_const(mAllocations, "FREE_TRACER", free_tracer);

    Init_allocations_state();

    state_const = rb_const_get(mAllocations, rb_intern("STATE"));
}