Skip to content

Instantly share code, notes, and snippets.

@nikushi
Created February 8, 2017 03:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikushi/ab5f10597eeb1d343043c5857bfccc2d to your computer and use it in GitHub Desktop.
Save nikushi/ab5f10597eeb1d343043c5857bfccc2d to your computer and use it in GitHub Desktop.
desc "Memory growth test"
task :mem_benchmark do
require 'testlib'
N = (ENV['N'] || 100_000).to_i
N.times do |i|
Testlib::do_something
if (i%10_000) == 0
GC.start
ruby_mem = ObjectSpace.memsize_of_all / 1_000
rss = `ps -o rss= -p #{Process.pid}`.to_i
puts "ruby_memory: #{ruby_mem}, rss: #{rss}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment