06-24-2018 11:40
06-24-2018 11:40
Hello all,
I have never had to work within memory constraints before developing my FitBit app. Before I published I decided to checkout how much memory this thing actually used.
I noticed that my memory is slowly ticking up and up by about 40 every second. Obviously this is not ideal because if the user leaves the app running for a while I don't want it to crash.
I have no idea what to look for when finding the memory issue... I made sure I have no variable declarations (let, const, var etc) in loops, but what else should i be looking for?
Could clock.ontick or setInterval have anything to do this? What else should I be looking for?
Thanks in advance!
Answered! Go to the Best Answer.
06-24-2018 12:35
06-24-2018 12:35
The memory will tick up but then get cleared by the built in garbage collector; at least that is what I observed working on my apps/faces.
06-24-2018 12:35
06-24-2018 12:35
The memory will tick up but then get cleared by the built in garbage collector; at least that is what I observed working on my apps/faces.
06-24-2018 13:14
06-24-2018 13:14
It looks to me like nothing is ever getting cleaned up and the memory usage just keeps growing indefinitely.
06-24-2018 13:21
06-24-2018 13:21
06-24-2018 13:26
06-24-2018 13:26
Well I feel silly now! I was watching my memory use tick up every second and I guess I didn't watch it long enough to see Garbage Collection actually happen!
Seems like everything is okay after all.
Thank you for the help!!
06-24-2018 13:28
06-24-2018 13:28
02-02-2019 09:14
02-02-2019 09:14
I was about to ask how you monitored the memory of your app because I recently hit the limit in mine, but then I found it, so I'm posting it here for anyone who has the same question: https://dev.fitbit.com/build/reference/device-api/system/#interface-memory
The emulator doesn't show your memory usage. I think it would be nice if it did. But a console log is almost just as good.
import { memory } from "system"; console.log("JS memory: " + memory.js.used + "/" + memory.js.total);