-
Notifications
You must be signed in to change notification settings - Fork 46
Tracking Memory Usage
adb shell cat /proc/meminfo
-
MemTotal
tells you how much device memory is available outside of drivers/kernel. -
MemFree
tells you how much memory is currently available, checking this after booting should give you a rough guesstimate of what our max is.
To simulate what would happen in a low-memory situation you can adb shell kill <pid>
each b2g process but b2g, (Nuwa), Homescreen (use b2g-ps
to get a b2g process listing). Unfortunately Homescreen just comes back (it can be LMK'd though, so add it's USS to the MemFree total to get a better idea of an ideal MemFree value).
adb shell b2g-procrank
(2.x? eng build?)
adb shell b2g-ps
(1.x? non-eng build?)
Note there are quite a few apps, some of which can get nuked when we need more memory (Homescreen, keyboard, preallocated, usage, etc). The most useful field for your app is probably USS
.
Use the get_about_memory.py
script from the mozilla-b2g/B2G repo.
Example:
git clone https://github.com/mozilla-b2g/B2G.git
cd B2G
tools/get_about_memory.py --minimize
This will write a set of files to about-memory-N. Load the URL it spits out in Firefox to view the memory report.
- Start with a clean profile only used for testing j2me.js. You probably want to disable e10s.
- Open your j2me.js app and about:memory
- Use the app
- Measure memory in about:memory
- click 'Minimize memory usage' - this will trigger a few rounds of gc/cc
- click 'Measure' to get a snapshot of memory usage