compact! only returns array if changes were made

This commit is contained in:
Carson Reinke 2015-10-27 12:27:37 -04:00
parent 6c172a30d3
commit df916e86b7

View File

@ -21,8 +21,8 @@ module MemoryDiagnostics
require 'objspace'
diff = diff.map do |id|
ObjectSpace._id2ref(id) rescue nil
end.compact!
diff ||= []
end
diff.compact!
report = "#{diff.length} objects have leaked\n"