Using too much memory - SOS Fault 1

Note that I did find out my error but some aspects of this puzzle me;
Note 2: The code below was typed in - not cutnpaste - so the odd semicolon may be missing

    #define ARRAY_SIZE 16000
    volatile int sound_array[ARRAY_SIZE];

void setup()
    for (int i=0;i<ARRAY_SIZE;i++)
void loop()

The mistake I had made was to define the array as int (4 bytes per int) when I should have defined it as an array of short’s (2 bytes).

The program compiles and the F/W downloads (This is for a photon BTW).

Straight away I get a SOS 1 and have to go to safe mode and reflash tinker (note I have this procedure down pat after doing 5-6 times while debugging).
Altering the array to shorts fixed the problem - in the first case I would be using 4 * 16000 = 64,000 bytes vs 32,000 bytes.

I am locally developing (particle-dev) and am wondering if there is any easy way to detect via the compiler/Atom if I have screwed the pooch vis-a-vis memory (RAM) usage?


Not in Particle Dev, but if you use CLI particle compile photon <projectfolder> you’ll get a memory report that gives you a clue.
BTW, Particle Build does so too.

Thanks for that @ScruffR - usefull hint (although in my case I am now aware of too much memory = hard fault) :smile:

I thought this was your question :confused:
And I answered exactly that

You did @ScruffR - and now I have the info I need - thanks.

1 Like