Created
June 22, 2012 02:41
-
-
Save tarcieri/2969877 to your computer and use it in GitHub Desktop.
How big is a Ruby thread? (a crude approximation on MRI/YARV on Linux)
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
1.9.3p194 :001 > base = Integer(`ps -o rss #{Process.pid}`[/\d+/]) | |
=> 5748 | |
1.9.3p194 :002 > Thread.new { sleep } | |
=> #<Thread:0x8db9d24 sleep> | |
1.9.3p194 :003 > Integer(`ps -o rss #{Process.pid}`[/\d+/]) - base | |
=> 20 |
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
From ps(1) on Linux: | |
The SIZE and RSS fields don't count some parts of a process including the page tables, kernel stack, struct thread_info, and struct task_struct. This | |
is usually at least 20 KiB of memory that is always resident. SIZE is the virtual size of the process (code+data+stack). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment