1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Feature test GC.stat(:total_allocated_objects) rather than check for JRuby

This commit is contained in:
Jean Boussier 2021-10-21 10:07:00 +02:00
parent 81d0dc90be
commit 9636b4da36

View file

@ -158,13 +158,15 @@ module ActiveSupport
end
end
if defined?(JRUBY_VERSION)
begin
GC.stat(:total_allocated_objects)
rescue ArgumentError # Likely on JRuby
def now_allocations
0
end
else
def now_allocations
GC.stat :total_allocated_objects
GC.stat(:total_allocated_objects)
end
end
end