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

feat: Implement process.getProcessMemoryInfo to get the process memory info #16591

Merged
merged 1 commit into from Jan 30, 2019

Conversation

nitsakh
Copy link
Contributor

@nitsakh nitsakh commented Jan 29, 2019

Backport of #14847.

Description of Change

Checklist

Release Notes

Notes: Added getProcessMemoryInfo API

…y usage (#14847)

* feat: Implement process.getMemoryFootprint to get the process memory usage

* Add spec

* fix: must enter node env in callback

* Update function call

* Update spec

* Update API data

* update spec

* Update include

* update test for shared bytes

* Update atom/common/api/atom_bindings.cc

Co-Authored-By: nitsakh <nitsakh@icloud.com>

* Update atom/common/api/atom_bindings.cc

Co-Authored-By: nitsakh <nitsakh@icloud.com>

* Update API

* Update the callback isolate

* Update to work after app ready

* Update docs

* Update docs/api/process.md

Co-Authored-By: nitsakh <nitsakh@icloud.com>

* Update docs/api/process.md

Co-Authored-By: nitsakh <nitsakh@icloud.com>

* Fix crash
@nitsakh nitsakh requested review from a team January 29, 2019 19:25
Copy link
Contributor

@miniak miniak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include this fix #16593


if (mate::Locker::IsBrowserProcess() && !Browser::Get()->is_ready()) {
promise->RejectWithErrorMessage(
"Memory Info is available only after app ready");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Memory Info is available only after app ready");
"Memory information is only available after the app's 'ready' event (See: electronjs.org/docs/api/app)");

memory consumed by the Electron code itself in Kilobytes.

Returns an object giving memory usage statistics about the current process. Note
that all statistics are reported in Kilobytes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
that all statistics are reported in Kilobytes.
that all statistics are reported in kilobytes.

(Typically spelled using lowercase)


Returns an object giving memory usage statistics about the current process. Note
that all statistics are reported in Kilobytes.
This api should be called after app ready.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This api should be called after app ready.
This API should not be called before the `app` has emitted the `ready` event.

that all statistics are reported in Kilobytes.
This api should be called after app ready.

Chromium does not provide `residentSet` value for macOS. This is because macOS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Chromium does not provide `residentSet` value for macOS. This is because macOS
Chromium does not provide a `residentSet` value for macOS. This is because macOS


Chromium does not provide `residentSet` value for macOS. This is because macOS
performs in-memory compression of pages that haven't been recently used. As a
result the resident set size value is not what one would expect. `private` memory
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
result the resident set size value is not what one would expect. `private` memory
result, the resident set size value is not what one would expect. `private` memory

@felixrieseberg
Copy link
Member

Sorry for the swarm of suggestions, feel free to disregard them as you please. Thank you for the overall effort!

@nitsakh
Copy link
Contributor Author

nitsakh commented Jan 30, 2019

😬 This is a backport of #14847 . Suggestions look good, but I'll probably address those in a separate PR.

@alexeykuzmin
Copy link
Contributor

@miniak I agree with Nitish, let's merge those changes separately.

@alexeykuzmin
Copy link
Contributor

@felixrieseberg Thank you for the suggestions, they're awesome.
But I agree with Nitish, let's make them in the master first, so we don't accidentally forget doing that after merging them here.

@MarshallOfSound MarshallOfSound merged commit ada60a9 into 4-0-x Jan 30, 2019
@release-clerk
Copy link

release-clerk bot commented Jan 30, 2019

Release Notes Persisted

Added getProcessMemoryInfo API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants