Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[close #39] Supporting different PIDs on Mac #41

Merged
merged 1 commit into from Aug 25, 2020

Commits on Aug 25, 2020

  1. [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.
    schneems committed Aug 25, 2020
    Configuration menu
    Copy the full SHA
    95a1e89 View commit details
    Browse the repository at this point in the history