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":
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:
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).
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": 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:
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).