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

Memory tracking in Google Chrome #2

Open
kirlat opened this issue Oct 1, 2018 · 0 comments
Open

Memory tracking in Google Chrome #2

kirlat opened this issue Oct 1, 2018 · 0 comments

Comments

@kirlat
Copy link
Member

kirlat commented Oct 1, 2018

Google Chrome has a set tools for tracking memory usage. Below are some notes on how to use these tools to get information about how much memory a script uses. Descriptions provided are for Chrome on Windows, it might be slightly different on other platforms.

Overall memory usage

Open DevTools (F12), go to the "memory" tab. Check memory usage under "Select JavaScript VM Instance":
image
The VM associated with the website that serves the page will show the memory usage of a webextension script. The number at the left, before the slash, is the amount of memory currently used by the script (that's what would interest us the most). The number at the right, after the slash, is the amount of memory allocated for the script. The latter is always greater than the former. The difference between the two is the amount of memory allocated for the script but not used yet, i.e. free memory within an allocation area.

However, amount of memory used does often include memory that is not referenced by a script (i.e. released by script's objects) but not garbage collected yet. To fix this we need to force garbage collection by clicking at the "Collect garbage" button at the top left corner:
image

After that the number at the left might drop down a little (if there was any memory not garbage collected) and will show the actual amount of memory that is used by a script.

It might grow after some actions to do memory allocation, but it should not grow indefinitely. It should also not grow after cyclical operations (opening and closing the same view several times, for example).

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

No branches or pull requests

1 participant