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

Implement Runtime.getHeapUsage for hermes chrome inspector #33173

Closed

Conversation

janicduplessis
Copy link
Contributor

@janicduplessis janicduplessis commented Feb 24, 2022

Summary

Reland of #32895 with fix for optional params object.

Original description:

I was looking at the hermes chrome devtools integration and noticed requests to Runtime.getHeapUsage which was not implemented. When implemented it will show a summary of memory usage of the javascript instance in devtools.

image

Changelog

[General] [Added] - Implement Runtime.getHeapUsage for hermes chrome inspector

Test Plan

I was able to reproduce the issue that caused the initial PR to be reverted using the resume request in Flipper. Pausing JS execution then resuming it will cause it to crash before this change, and works fine after.

Before

image

After

image

…32895)

Summary:
I was looking at the hermes chrome devtools integration and noticed requests to `Runtime.getHeapUsage` which was not implemented. When implemented it will show a summary of memory usage of the javascript instance in devtools.

<img width="325" alt="image" src="https://user-images.githubusercontent.com/2677334/149637113-e1d95d26-9e26-46c2-9be6-47d22284f15f.png">

## Changelog

[General] [Added] - Implement Runtime.getHeapUsage for hermes chrome inspector

Pull Request resolved: facebook#32895

Test Plan:
Before

<img width="912" alt="image" src="https://user-images.githubusercontent.com/2677334/149637073-15f4e1fa-8183-42dc-8673-d4371731415c.png">

After

<img width="1076" alt="image" src="https://user-images.githubusercontent.com/2677334/149637085-579dee8f-5efb-4658-b0a8-2400bd119924.png">

Reviewed By: christophpurrer

Differential Revision: D33616658

Pulled By: ShikaSD

fbshipit-source-id: 49d863e6a58d4a92d4c86f9a288ac33ed8d2cb0d
@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 Feb 24, 2022
@facebook-github-bot facebook-github-bot added Contributor A React Native contributor. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Feb 24, 2022
@react-native-bot react-native-bot added the Type: Enhancement A new feature or enhancement of an existing feature. label Feb 24, 2022
@analysis-bot
Copy link

analysis-bot commented Feb 24, 2022

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: 189c2c8
Branch: main

@analysis-bot
Copy link

analysis-bot commented Feb 24, 2022

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,189,539 -14,662
android hermes armeabi-v7a 7,789,970 -21,098
android hermes x86 8,559,628 -16,116
android hermes x86_64 8,512,023 -14,519
android jsc arm64-v8a 9,857,803 -15,141
android jsc armeabi-v7a 8,843,118 -21,242
android jsc x86 9,824,494 -16,076
android jsc x86_64 10,420,967 -14,530

Base commit: 189c2c8
Branch: main

@facebook-github-bot
Copy link
Contributor

@ShikaSD has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@ShikaSD
Copy link
Contributor

ShikaSD commented Feb 25, 2022

hey, I see this test failing in internal CI:

https://github.com/facebook/react-native/blob/e737270d118c3d5c992ec247a8695fb3acc4cacd/ReactCommon/hermes/inspector/chrome/tests/MessageTests.cpp#L691:L718

seems like re-serialized version contains param object, could you update the test or change serialization strategy? 🙂

@janicduplessis
Copy link
Contributor Author

@ShikaSD I updated the test, I can't run it locally tho since the BUCK config depends on FB internal stuff.

@facebook-github-bot
Copy link
Contributor

@ShikaSD has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @janicduplessis in cff9590.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label Mar 1, 2022
@janicduplessis janicduplessis deleted the profile-heap-info-v2 branch March 1, 2022 18:35
Saadnajmi pushed a commit to Saadnajmi/react-native-macos that referenced this pull request Jan 15, 2023
…33173)

Summary:
Reland of facebook#32895 with fix for optional params object.

Original description:

I was looking at the hermes chrome devtools integration and noticed requests to `Runtime.getHeapUsage` which was not implemented. When implemented it will show a summary of memory usage of the javascript instance in devtools.

<img width="325" alt="image" src="https://user-images.githubusercontent.com/2677334/149637113-e1d95d26-9e26-46c2-9be6-47d22284f15f.png">

[General] [Added] - Implement Runtime.getHeapUsage for hermes chrome inspector

Pull Request resolved: facebook#33173

Test Plan:
I was able to reproduce the issue that caused the initial PR to be reverted using the resume request in Flipper. Pausing JS execution then resuming it will cause it to crash before this change, and works fine after.

Before

<img width="912" alt="image" src="https://user-images.githubusercontent.com/2677334/149637073-15f4e1fa-8183-42dc-8673-d4371731415c.png">

After

<img width="1076" alt="image" src="https://user-images.githubusercontent.com/2677334/149637085-579dee8f-5efb-4658-b0a8-2400bd119924.png">

Reviewed By: jpporto

Differential Revision: D34446672

Pulled By: ShikaSD

fbshipit-source-id: 6e26b8d53cd88cddded36437c72a01822551b9d0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Contributor A React Native contributor. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. Type: Enhancement A new feature or enhancement of an existing feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants