in ext/liballocations/liballocations.c [15:37]
void newobj_callback(VALUE tracepoint, void* data) {
rb_trace_arg_t *trace_arg = rb_tracearg_from_tracepoint(tracepoint);
st_data_t count = 0;
AllocationState *state = allocation_state_get_struct(state_const);
VALUE klass = rb_tracearg_defined_class(trace_arg);
/* These aren't actually allocated so there's no point in tracking them. */
if ( klass == Qtrue || klass == Qfalse || klass == Qnil ) {
return;
}
// We don't care about sigleton classes since only one of them exists at a
// time. The logic here is stolen from MRI's implementation of
// Class#singleton_class? as MRI sadly provides no public C function for
// this method.
if ( IS_SINGLETON(klass) ) return;
st_lookup(state->object_counts, (st_data_t) klass, &count);
st_insert(state->object_counts, (st_data_t) klass, count + 1);
}