Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[close #39] Supporting different PIDs on Mac
Currently when you call `GetProcessMem.new` with a different pid value than the current process it calls `GetProcessMem::Darwin.resident_size this uses FFI to get data from the mach kernel about the current process. - #32 - https://stackoverflow.com/questions/18389581/memory-used-by-a-process-under-mac-os-x/23379216#23379216 This PR adds a test to ensure that memory results from different processes is correctly reported. This PR addresses the different PID problem by checking if a different pid other than Process.pid is being passed in. If that's the case then we will fall back to determining memory based off of shelling out to `ps`. There was a performance concern over using `Process.pid` but it appears to be relatively fast. It is approximately the speed of allocating 3 string object.
- Loading branch information