Sha256: 6d7c5768e903b30b03f5ea55b62a883537cb0a67cc1f152a34115d937d1ef71c
Contents?: true
Size: 352 Bytes
Versions: 32
Compression:
Stored size: 352 Bytes
Contents
def measure_memory(annotation = "Memory allocated") GC.disable start_memory = `ps -p #{Process::pid} -o rss`.split("\n")[1].chomp.to_i yield ensure end_memory = `ps -p #{Process::pid} -o rss`.split("\n")[1].chomp.to_i memory_usage = (end_memory - start_memory).to_f / 1024 puts "#{memory_usage.round(1)} MB: #{annotation}" GC.enable end
Version data entries
32 entries across 32 versions & 1 rubygems