Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ext/fiber/profiler/capture.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ void Fiber_Profiler_Capture_Call_initialize(void *element) {

call->event_flag = 0;
call->id = 0;
call->klass = Qnil;

call->path = NULL;
call->line = 0;
Expand Down
22 changes: 22 additions & 0 deletions test/fiber/profiler/capture.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,28 @@ def nested(n = 100, &block)
end
end

with "blocks outside of methods" do
# Blocks defined outside of a method don't have a method or class:
work = proc do
String.new
[1, 2].each{sleep 0.001}
end

it "doesn't report a class left over from an earlier call" do
capture.start

Fiber.new(&work).resume

capture.stop

stall = JSON.parse(output.string)
classes = stall["calls"].map{|call| call["class"]}

expect(classes).not.to have_value(be == "String")
expect(classes).not.to have_value(be == "false")
end
end

with "Process.fork" do
it "should disable the profiler in the child process after fork" do
capture.start
Expand Down
Loading