I've only been coding Connect IQ apps for a few months so I'm still pretty green, but I'm hoping someone can help me understand memory limits, and what appears to be strange memory-related behavior. My first question is - does there exist a reference that documents the available memory for each Connect IQ device? The only thing I've seen are the values in the 'devices.xml' file which appears to be used by the device simulator to mimic the behavior and capabilities of each device. So I'm guessing that these values are representative of those which apply to the associated hardware devices?
Thus far I'm only working with / coding for the Epix device. From the 'devices.xml' file:
<app id="watchface" memory_limit="1048576" />
<app id="watch-app" memory_limit="1048576" />
<app id="widget" memory_limit="1048576" />
<app id="datafield" memory_limit="131072" />
This would seem to imply that a data field could be up to about 128K, while watch faces, applications and widgets could be almost 1MB. I've created a (very) complex data field which is working on the Epix. An example of reported memory values when the data field loads:
Memory used = 60952kb, free = 70104kb, total = 131072kb
So far so good, and this gives me the (apparently false ;-) sense that I've still got plenty of memory to work with. However, after making some minor changes, suddenly I start getting errors which are repeatable, but completely nonsensical, and which prevent the data field from loading/running in the simulator. The only rational explanation seems to be some type of memory overflow/corruption. Even after refactoring some code and getting reported memory used *below* what was previously working, I was still getting the same bizarre behavior:
Memory used = 59160kb, free = 71896kb, total = 131072kb
After performing more extensive refactoring and reducing memory usage further I was eventually able to get the code to run once more. However, I'm wondering if anyone can help me understand why I'm having problems when it appears that I'm using less than 1/2 of the available memory?
Among other things, I'd like to understand this because I was hoping to port this data field to other devices. However, I'm thinking that may not be possible. For example, the Forerunner 920XT seemed like the logical next step, until I saw this:
<app id="watchface" memory_limit="65536" />
<app id="watch-app" memory_limit="65536" />
<app id="widget" memory_limit="65536" />
<app id="datafield" memory_limit="16384" />
Assuming these values are correct, then even converting my data field in to an application would be a waste of time. Can anyone confirm / refute that conclusion?
Thanks - David