Skip to content

Instantly share code, notes, and snippets.

@arp
Last active December 14, 2015 09:09
Show Gist options
  • Save arp/5062607 to your computer and use it in GitHub Desktop.
Save arp/5062607 to your computer and use it in GitHub Desktop.
A script that tries to eat up 2GB of RAM every second. Can be used to test if memory usage alerts work correctly.
#!/usr/bin/env ruby
#
# This script tries to eat up 2GB of RAM every second
# It can be used to test if memory usage alerts work correctly
GB_PER_STEP = 2
str = ''
ate = 0
puts "Hey, you do have too much free RAM! Don't worry as we'll fix this very soon."
loop do
str << 'x' * (GB_PER_STEP * 1024 * 1024 * 1024)
ate += GB_PER_STEP
puts "Ate #{ate}GB..."
sleep 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment