perf/core: Fix Undefined behaviour in rb_alloc()