From b8a3f1bd456f92866c4a7bd83235f78c574784a8 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Tue, 3 Jan 2023 10:59:47 -0500 Subject: Fix crash in tracing object allocations ObjectSpace.trace_object_allocations_start could crash since it adds a TracePoint for when objects are freed. However, TracePoint could crash since it modifies st tables while inside the GC that is trying to free the object. This could cause a memory allocation to happen which would crash if it triggers another GC. See a crash log: http://ci.rvm.jp/results/trunk@ruby-sp1/4373707 --- gc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gc.h') diff --git a/gc.h b/gc.h index b2356444c6..23218c1a9e 100644 --- a/gc.h +++ b/gc.h @@ -116,8 +116,6 @@ int ruby_get_stack_grow_direction(volatile VALUE *addr); const char *rb_obj_info(VALUE obj); const char *rb_raw_obj_info(char *const buff, const size_t buff_size, VALUE obj); -VALUE rb_gc_disable_no_rest(void); - struct rb_thread_struct; size_t rb_size_pool_slot_size(unsigned char pool_id); @@ -142,6 +140,8 @@ void rb_objspace_each_objects_without_setup( size_t rb_gc_obj_slot_size(VALUE obj); +VALUE rb_gc_disable_no_rest(void); + RUBY_SYMBOL_EXPORT_END #endif /* RUBY_GC_H */ -- cgit v1.2.3