Currently, Firefox OS is mainly intended for the low-end mobile phone market, while low-end memory is very small. In such a hardware environment, it is harsh for application developers, especially in the memory, OOM is possible if you don't pay attention to it. Therefore, you must always pay attention to the memory consumption during application development and testing.
B2G now provides a memory testing tool. Next, we will briefly introduce how to use this tool in B2G_DESKTOP in linux.
Start your B2G_DESKTOP simulator first
Open a terminal tool and run the command
Kill-34 $ (pidof b2g)
In the kill command, the value after-34 is the Command reserved by the operating system for the application. The b2g uses the-34 command to generate a memory-report.
If the b2g process is killed after you run this command, Your b2g tool version is too low and you need to upgrade it to a newer version.
After the command is run successfully, multiple memory-report-* .json.gz files are generated in the/tmp directory.
Run commands
Gunzip/tmp/memory-report * .json.gz
Decompress all of them. After decompression, multiple memory-report *. json files will be generated. These are the memory-report files applied in b2g.
Memory-reports are json data, which is ugly. You can use the tools provided by firefox nightly build to view these memory reports.
Open firefox nightly build, enter "about: memory" in the address bar, click "read reports from a file" in the following buttons, and select the json file decompressed, you can view the application memory report in the following format:
Click to view the chart
Memory_report sample report download: http://chyblog-chyblog.stor.sinaapp.com/wp-content/uploads/2012/11/memory_report.zip
This report mainly looks at the explicit section and expands the tree directory to see more detailed information.