-
-
Notifications
You must be signed in to change notification settings - Fork 32
Speed vs Memory
Daniel Berger edited this page Feb 20, 2018
·
3 revisions
The Sys::ProcTable.ps method provides two different ways to read processes - with a block, or without a block.
This approach reads one record at a time and yields it to the block. It is slower, but memory efficient.
Sys::ProcTable.ps{ |process| ... }
This approach reads everything into memory and then hands it to you as an array. It is faster, but can potentially consume quite a bit of memory.
Sys::ProcTable.ps.each{ |process| ... }
Starting with version 1.2, you can disable certain information from being collected using keyword arguments. For example, smaps information on Linux can consume a fair amount of memory, so you may want to disable that if you don't care about smaps information.
Sys::ProcTable.ps(smaps: false)