Do not assume all interpreter versions support allocation tracing

This commit is contained in:
Lourens Naudé 2014-12-07 23:28:38 +00:00
parent fb60daa867
commit 2f75078758
1 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,10 @@
if ENV['DISCOURSE_DUMP_HEAP'] == "1"
require 'objspace'
ObjectSpace.trace_object_allocations_start
begin
ObjectSpace.trace_object_allocations_start
rescue NoMethodError
puts "Heap dumps not available for Ruby #{RUBY_VERSION} (> 2.1 required)"
end
end
require 'rubygems'