Memory usage changes?

Discussion around the SwissMicros DM42 calculator
Dave Britten
Posts: 137
Joined: Wed Jun 14, 2017 9:27 pm

Re: Memory usage changes?

Post by Dave Britten »

A little more experimenting:

I flashed my older unit back to the 3.15/3.14 firmware (July 2019), loaded the state file, and had about 35K RAM free. Then I created and stored a 640x3 matrix, leaving around 3K free. Then I did GTO .. and the calculator crashed, flashing something on the screen far too quickly for me to read any of it, and hanging at "Loading". I pressed Reset, and it's showing the "RESET in protected area" message (Reg Id d3770102, fw 3.15).

This leads me to suspect the older firmware could be overestimating the amount of free memory, and attempting to actually use that much is causing some kind of buffer overrun, or heap/stack collision. But the current firmware seems to be consuming far more memory than the size of the state file would suggest, unless the state files are heavily compressed.
Thomas Okken
Posts: 1107
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: Memory usage changes?

Post by Thomas Okken »

Dave Britten wrote:
Fri Oct 30, 2020 1:22 pm
unless the state files are heavily compressed.
They are not. The size of a state file is roughly the same as the amount of memory it takes up when loaded. Programs about double in size when loaded, while the overhead for other data types is much smaller.
Dave Britten
Posts: 137
Joined: Wed Jun 14, 2017 9:27 pm

Re: Memory usage changes?

Post by Dave Britten »

Thomas Okken wrote:
Fri Oct 30, 2020 1:53 pm
Dave Britten wrote:
Fri Oct 30, 2020 1:22 pm
unless the state files are heavily compressed.
They are not. The size of a state file is roughly the same as the amount of memory it takes up when loaded. Programs about double in size when loaded, while the overhead for other data types is much smaller.
Okay, then the disparity isn't QUITE as striking, since my state file is mostly programs, and a handful of variables and small matrices. The raw files I exported yesterday total 17,864 bytes, which is 35,728 when exactly doubled. The state file is 25,396 bytes, so roughly 7,532 bytes of data, meaning somewhere around 43,260 bytes consumed in total. Still a good way off from the ~70K free after a reset, though. I think we might need SM to weigh in on this. Does the DMCP OS end up "stealing" some of this memory for its own heap, or is that 70K supposed to be reserved exclusively for Free42's use?
Post Reply