Fix compaction check for ObjectSpace.trace_object_allocations

We should be checking for key for moved objects rather than the value
because the key is a Ruby object and the value is malloc'd memory.
This commit is contained in:
Peter Zhu 2024-12-13 12:20:01 -05:00
parent 39d0ebb6e8
commit b038530506
Notes: git 2024-12-16 15:13:14 +00:00

View File

@ -192,9 +192,7 @@ allocation_info_tracer_memsize(const void *ptr)
static int
hash_foreach_should_replace_key(st_data_t key, st_data_t value, st_data_t argp, int error)
{
VALUE allocated_object;
allocated_object = (VALUE)value;
VALUE allocated_object = (VALUE)key;
if (allocated_object != rb_gc_location(allocated_object)) {
return ST_REPLACE;
}