Skip to content

Instantly share code, notes, and snippets.

@jacobat
Created November 28, 2012 22:09
Show Gist options
  • Save jacobat/4165023 to your computer and use it in GitHub Desktop.
Save jacobat/4165023 to your computer and use it in GitHub Desktop.
def print_memory_usage
memory_usage = `ps -p #{Process.pid} -o rss=`.chomp
puts "Memory usage: #{memory_usage}"
end
print_memory_usage
a = ['a'] * 10000000
print_memory_usage
a = nil
GC.start
print_memory_usage
@jacobat
Copy link
Author

jacobat commented Nov 28, 2012

Memory usage: 4160
Memory usage: 82432
Memory usage: 82436

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment