Created
May 12, 2015 19:57
-
-
Save gavingmiller/ba45f154d6ed341e17d9 to your computer and use it in GitHub Desktop.
Dumping Memory from Heroku to S3
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
def dump_memory | |
GC.start | |
time = DateTime.now.strftime('%-l%M') | |
path = Rails.root.join("tmp/ruby-heap.#{time}.dump") | |
io = File.open(path, "w") | |
ObjectSpace.dump_all(output: io) | |
io.close | |
bucket = $s3.buckets['mah-bucket'] | |
obj = bucket.objects[time] | |
obj.write(IO.binread(path)) | |
render text: "success - #{time}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment