Skip to content

Fix memory usage display in Perf Monitor#19664

Closed
dexterhahaha wants to merge 3 commits intofacebook:masterfrom
dexterhahaha:master
Closed

Fix memory usage display in Perf Monitor#19664
dexterhahaha wants to merge 3 commits intofacebook:masterfrom
dexterhahaha:master

Conversation

@dexterhahaha
Copy link
Copy Markdown

@dexterhahaha dexterhahaha commented Jun 12, 2018

According to: https://github.com/apple/darwin-xnu/blob/master/osfmk/kern/bsd_kern.c#L420
The result is the same as Xcode app memory uesd.

Test Plan

Before Fix:

before

before1

After Fix:
after
after1

Related PRs

Release Notes

[IOS] [BUGFIX] [Monitor] - fix memory perf monitor. Make sure the memory footprint is the same as Jetsam.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@react-native-bot react-native-bot added ✅Test Plan Missing Changelog This PR appears to be missing a changelog, or they are incorrectly formatted. labels Jun 12, 2018
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 12, 2018
@facebook-github-bot
Copy link
Copy Markdown
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@hramos
Copy link
Copy Markdown
Contributor

hramos commented Jun 12, 2018

Can you elaborate? What issue does this fix, how was this tested?

@dexterhahaha
Copy link
Copy Markdown
Author

dexterhahaha commented Jun 13, 2018

Make sure the memory footprint is the same as Xcode monitor.
iOS Jetsam(out of memory) use this method to measure process memory usage.

Before change:

before

before1

**After change: **

after

after1

@zhongwuzw
Copy link
Copy Markdown
Contributor

@JunyiXie Xcode 's memory gauge is good for noticing memory usage trends, and is only a barometer refer to the developer from Apple, see Difference in iOS memory allocation measurement between XCode and instruments.

You can have Allocation template of Instruments to see the memory use.

@dexterhahaha
Copy link
Copy Markdown
Author

dexterhahaha commented Jun 13, 2018

@zhongwuzw
Monitoring should accurately reflect the process memory footprint. There is no relationship with memory debugging.
iOS Jetsam(out of memory) use this method to measure process memory usage.

It is necessary to be consistent with the system memory processing mechanism.

@hramos hramos added Missing Test Plan This PR appears to be missing a test plan. and removed Missing Changelog This PR appears to be missing a changelog, or they are incorrectly formatted. ✅Test Plan labels Jun 13, 2018
@hramos hramos requested a review from shergin June 13, 2018 17:37
@hramos hramos added the Missing Changelog This PR appears to be missing a changelog, or they are incorrectly formatted. label Jun 13, 2018
Copy link
Copy Markdown
Contributor

@hramos hramos left a comment

Choose a reason for hiding this comment

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

Please provide a proper test plan and release notes.

@hramos hramos changed the title Fix memory usage Fix memory usage display in Perf Monitor Jun 13, 2018
@react-native-bot react-native-bot added ✅Test Plan and removed Missing Test Plan This PR appears to be missing a test plan. labels Jun 13, 2018
@dexterhahaha
Copy link
Copy Markdown
Author

dexterhahaha commented Jun 14, 2018

Is the pull request format correct now?

@react-native-bot react-native-bot added 🐛Bug Fix Platform: iOS iOS applications. and removed Missing Changelog This PR appears to be missing a changelog, or they are incorrectly formatted. labels Jun 14, 2018
@hramos
Copy link
Copy Markdown
Contributor

hramos commented Jun 14, 2018

Thank you!

Copy link
Copy Markdown
Contributor

@hramos hramos left a comment

Choose a reason for hiding this comment

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

I'll let @shergin or someone more familiar with iOS tooling approve this.

Comment thread React/Profiler/RCTPerfMonitor.m Outdated
if(kernelReturn == KERN_SUCCESS) {
memoryUsageInByte = (vm_size_t) vmInfo.phys_footprint;
} else {
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can you remove this empty else block safely?

Delete useless logic. Don't have  bad effect .
@dexterhahaha
Copy link
Copy Markdown
Author

Delete useless logic.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@JunyiXie I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project.

@facebook-github-bot facebook-github-bot added the Import Started This pull request has been imported. This does not imply the PR has been approved. label Aug 9, 2018
Copy link
Copy Markdown
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

hramos is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was closed by @JunyiXie in eb1ce28.

Once this commit is added to a release, you will see the corresponding version tag below the description at eb1ce28. If the commit has a single master tag, it is not yet part of a release.

@facebook facebook locked as resolved and limited conversation to collaborators Aug 9, 2018
@react-native-bot react-native-bot added the Merged This PR has been merged. label Aug 9, 2018
kelset pushed a commit that referenced this pull request Aug 13, 2018
Summary:
According to: https://github.com/apple/darwin-xnu/blob/master/osfmk/kern/bsd_kern.c#L420
The result is the same as Xcode app memory uesd.

Before Fix:

<img width="250" alt="before" src="https://user-images.githubusercontent.com/22233256/41394508-ce810362-6fdc-11e8-8d40-73703ec93bc3.png">
<img width="266" alt="before1" src="https://user-images.githubusercontent.com/22233256/41394511-d00a9a0e-6fdc-11e8-9f18-2198e8de2410.png">

After Fix:
<img width="270" alt="after" src="https://user-images.githubusercontent.com/22233256/41394517-d5a56ff2-6fdc-11e8-8d19-41e046c4b511.png">
<img width="267" alt="after1" src="https://user-images.githubusercontent.com/22233256/41394520-d7a3c600-6fdc-11e8-98c4-e3024a4532ec.png">

<!--
  Does this PR require a documentation change?
  Create a PR at https://github.com/facebook/react-native-website and add a link to it here.
-->

[IOS] [BUGFIX] [Monitor] - fix memory perf monitor. Make sure the memory footprint is the same as Jetsam.

<!--
  **INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

    CATEGORY
  [----------]      TYPE
  [ CLI      ] [-------------]    LOCATION
  [ DOCS     ] [ BREAKING    ] [-------------]
  [ GENERAL  ] [ BUGFIX      ] [ {Component} ]
  [ INTERNAL ] [ ENHANCEMENT ] [ {Filename}  ]
  [ IOS      ] [ FEATURE     ] [ {Directory} ]   |-----------|
  [ ANDROID  ] [ MINOR       ] [ {Framework} ] - | {Message} |
  [----------] [-------------] [-------------]   |-----------|

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
Pull Request resolved: #19664

Differential Revision: D9246307

Pulled By: hramos

fbshipit-source-id: f85efc54cdcb0c19677594d465752c666d5af18b
@hramos hramos removed Import Started This pull request has been imported. This does not imply the PR has been approved. labels Feb 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Bug CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Platform: iOS iOS applications.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants