Skip to content

Commit 9636b4d

Browse files
committed
Feature test GC.stat(:total_allocated_objects) rather than check for JRuby
1 parent 81d0dc9 commit 9636b4d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

activesupport/lib/active_support/notifications/instrumenter.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,15 @@ def now_cpu
158158
end
159159
end
160160

161-
if defined?(JRUBY_VERSION)
161+
begin
162+
GC.stat(:total_allocated_objects)
163+
rescue ArgumentError # Likely on JRuby
162164
def now_allocations
163165
0
164166
end
165167
else
166168
def now_allocations
167-
GC.stat :total_allocated_objects
169+
GC.stat(:total_allocated_objects)
168170
end
169171
end
170172
end

0 commit comments

Comments
 (0)