From 7806a6e714212a3fccc5ea41e201a1d054719437 Mon Sep 17 00:00:00 2001 From: CatWindow Date: Sun, 16 Aug 2026 19:27:28 +0300 Subject: [PATCH] profiler fix --- binding-mri/profiler-binding.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/binding-mri/profiler-binding.cpp b/binding-mri/profiler-binding.cpp index c48e938..b47db51 100644 --- a/binding-mri/profiler-binding.cpp +++ b/binding-mri/profiler-binding.cpp @@ -8,7 +8,7 @@ #include #include VALUE tp = Qnil; -static std::vector call_stack; // Глобальный стек вместо thread-local +static std::vector call_stack; static uint64_t now_ns(void) { timespec ts; @@ -35,12 +35,11 @@ static void tp_cb(VALUE tpval, void *) { call_stack.pop_back(); uint64_t dur_ns = end_ns - start_ns; - // Сохраняем VALUE в переменные ПЕРЕД StringValuePtr VALUE path_val = rb_tracearg_path(trace_arg); VALUE class_val = rb_tracearg_defined_class(trace_arg); const char *path = StringValuePtr(path_val); - const char *class_name = StringValuePtr(class_val); + const char *class_name = rb_class2name(class_val); long line = FIX2LONG(rb_tracearg_lineno(trace_arg)); const char *method = rb_id2name((ID)rb_tracearg_method_id(trace_arg)); @@ -49,7 +48,6 @@ static void tp_cb(VALUE tpval, void *) { } } - static VALUE profiler_set(VALUE, VALUE v) { if (NIL_P(tp)) { rb_raise(rb_eRuntimeError, "Profiler not initialized");