Skip to content

Commit 8a5969d

Browse files
committed
Take VM barrier on ObjectSpace.count_objects
1 parent a0e0be9 commit 8a5969d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

gc.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2504,7 +2504,11 @@ count_objects(int argc, VALUE *argv, VALUE os)
25042504
VALUE total = ID2SYM(rb_intern("TOTAL"));
25052505
VALUE free = ID2SYM(rb_intern("FREE"));
25062506

2507-
rb_gc_impl_each_object(rb_gc_get_objspace(), count_objects_i, &data);
2507+
RB_VM_LOCKING() {
2508+
rb_gc_vm_barrier();
2509+
2510+
rb_gc_impl_each_object(rb_gc_get_objspace(), count_objects_i, &data);
2511+
}
25082512

25092513
if (NIL_P(hash)) {
25102514
hash = rb_hash_new();

0 commit comments

Comments
 (0)