Created
February 8, 2017 03:06
-
-
Save nikushi/ab5f10597eeb1d343043c5857bfccc2d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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