Created
October 7, 2021 05:59
-
-
Save amitpatelx/662bf7d95c09d4374f08e2badc6d549c to your computer and use it in GitHub Desktop.
Uses the ps shell command to get a rough idea of the program’s current memory size
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 memstats | |
size = `ps -o size= #{$$}`.strip.to_i | |
"Size: #{size}" | |
end | |
# Source: https://www.rubytapas.com/2013/01/04/episode-042-streaming/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment