Last active
December 14, 2015 09:09
-
-
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.
This file contains 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
#!/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