Ticket Created
over 4 years ago

WERETECH-9896

Memory fragmentation in FW?

My long running app crashes and I suspect memory fragmentation in the FW.

It ran for 1:45 on my F5 before crashing out of memory: 

Error: Out Of Memory Error
Details: 'Failed invoking <symbol>'
Time: 2020-10-17T02:18:02Z
Part-Number: 006-B2697-00
Firmware-Version: '20.00'
Language-Code: eng
ConnectIQ-Version: 3.1.9
Filename: RACEQS
Appname: raceQs
Stack: 
  - pc: 0x30000e9b


Note that the location 0x30000e9 is well outside the memory addresses of my code.

I'm monitoring the memory usage at the start of each GPS location cycle and it is steady at around 102 kB.

The crash occurred independently of any user input: it was running fine and then, a few minutes later when I next looked at the watch, it had crashed.

I have run the app twice through the simulator using the FIT file generated in the original session, as far as possible performing the same user inputs as on the original session. The memory usage remains around 105kB. The peak memory remains firmly at 117.5kB.

It peaks at the start of the app when it downloads a large data file containing the race courses and rounding marks.

I have had a  small number of similar reports of out of memory errors via ERA on a range of devices:  Forerunner® 245: 5.00, vívoactive® 3: 7.40, all reporting memory crashes, but all at different code locations.

This behaviour indicates, and I say this with much trepidation after many decades of software development, that the issue is not with my code, but with the underlying firmware, operating system or hardware.

Given that it only occurs sporadically and in my test, only after a long period of running (1h 50 mins), I wonder if it is being caused by memory fragmentation in the FW?

And if so, what can I do about it?


P.S.I had a similar problem on this platform a couple of years ago and discovered the fault was with my code: I had a hierarchy of menus and was not Popping them correctly. At the time, the simulator behaved differently and did not show my memory leak. Since then, I am logging memory usage at the start of each GPS callback to capture any such oversights. 

Parents
  • Yes, I know.

    I am not adding to any arrays or growing strings. 

    I am updating, not adding to, my big array every second, just holding the latest 120 seconds of data using an index to manage a cyclic buffer.

    And anyway, if I were adding to array or building strings, it would show up with the way I'm monitoring memory: as I said, in live running, I am monitoring memory each GPS cycle (1Hz). It remains steady at around 102kB.

Comment
  • Yes, I know.

    I am not adding to any arrays or growing strings. 

    I am updating, not adding to, my big array every second, just holding the latest 120 seconds of data using an index to manage a cyclic buffer.

    And anyway, if I were adding to array or building strings, it would show up with the way I'm monitoring memory: as I said, in live running, I am monitoring memory each GPS cycle (1Hz). It remains steady at around 102kB.

Children