Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Memory monitoring questions

Two questions:

1. I'm trying to use the memory pressure event to determine where my clock face is running low on memory, but it doesn't seem to trigger. I can't be sure I'm doing it right, the documentation seems vague. Here's what I have coded:

 

import { memory } from "system";

memory.onmemorypressurechange = function(a) {
console.log("memoryPressureChange:" + JSON.stringify(a));
}

 

It doesn't give me any errors, but it doesn't seem to ever trigger.

 

2. I was curious how much native memory my watch face is using, so I added console.log lines like this:

console.log("js memory: " + memory.js.used + "/" + memory.js.total + " peak:" + memory.js.peak);
console.log("native memory: " + memory.native.used + "/" + memory.native.total + " peak:" + memory.native.peak);

 

Output:

[10:26:00 AM] App: js memory: 38944/65528 peak:51792 (app/index.js:957,2)

[10:26:00 AM] App: native memory: 0/1 peak:0 (app/index.js:958,2)

 

The js memory numbers look reasonable, but the native memory is always 0 used, 1 total, 0 peak. Seems a bit low to me :). Am I doing something wrong?

 

Update: I've been testing on the simulator, I just tried it on the watch and I do get reasonable numbers for the native memory on the watch. Apparently the simulator doesn't emulate this native memory function. The memory pressure event still doesn't ever seem to fire, however.

Best Answer
0 Votes
0 REPLIES 0