SOS Heap error after using latest SparkCore firmware


Today I downloaded the latest SparkCore firmware from GitHub and tried it together with my own application.
Unfortunaltely I got a SOS Heap error (flashing red 8 times after SOS).
When I looked at the memory usage I saw a big increase of the used RAM memory (data + bss), exeeding the 16K limit.

  • In the old situation the RAM usage was 3032 + 12356 = 15388 bytes
  • In the new situation the RAM usage is 3212 + 13400 = 16612 bytes

Without changing my own application the memory usage has increased with 1224 bytes, resulting in the heap errror.
Is there a way to reduce the RAM usage from the SparkCore?
I have put quite some effort in reducing the amount of RAM of my own application, I don’t know how reduce it with roughly 612 bytes again.


Here the info after building:

**OLD SparkCore firmware from 28-april-2014 + my own application**
Invoking: ARM GNU Print Size
arm-none-eabi-size --format=berkeley core-firmware.elf
   text       data        bss        dec        hex    filename
  89900       3032      12356     105288      19b48    core-firmware.elf

**NEW SparkCore firmware from 15-may-2014 + my own application**
Invoking: ARM GNU Print Size
arm-none-eabi-size --format=berkeley core-firmware.elf
   text       data        bss        dec        hex    filename
  92244       3212      13400     108856      1a938    core-firmware.elf

There were some firmware improvements but shouldn’t lead to SOS.

I’ll ping @zachary here :slight_smile:

1 Like

Hi @nika8991,

Sorry about that! The latest firmware push seemed to take up more ram than we were expecting.

While we’re working on reducing the baseline ram usage in the firmware, if you wanted to post your code we can try to help look for any low hanging fruit. If you’re building locally and using tcp/udp clients, you can also reduce your TCP client / UDP client buffer sizes which is an easy save.


Hi @Dave,
I reduced the UDP client buffer from 512 to 256 bytes, that solves the problem of the Heap error.

1 Like

Great, glad to hear you worked it out. We appreciate the feedback. We’ll make sure to reduce RAM usage in the next release. Spark.subscribe accounts for at least 256 bytes, but the jump of more than 1kb is surprising. Thanks for documenting those numbers side by side for us.

1 Like

Hi @zachary,

I am using the Publish feature to send information from the SparkCore towards a small server running on Node.js.  
I noticed that changing the TCP client buffer did not made any difference on the amount of used RAM while changing the UDP client buffer showed it immediately.

Is my asumption correct that Publish is using the UDP protocol?
Could that also be the reason that I sometimes miss some published messages?
I send roughly 20 to 50 messages in a sequence, with a pause of one second between each message. After the sequense there will be a much longer pause, sometimes a few hours.


I want to thank the Spark Team and the community for the great support of this amazing product!!!

1 Like

Hey :spark: community,

As you know the :spark: Team and Elites are committed to doing our best and make :spark: core awesome…

This is a new feature in the Web IDE which should already be available to everyone!

Displaying Ram Usage when verifying

*Right now, you need to modify the code each time before you verify. Something like adding a SPACE works too.

It’s a hard backend issue to display it every time but we are looking into it!

Special thanks to:

@bko for the script to extract the information,
@jgoggins for pushing this feature fast,
@Dave for changing the backend and
@shime who did the IDE changes!

Not forgetting everyone in the :spark: Elite who came up with this idea and made it happen in a short span of 16 Days (minus 5 days for Maker Faire)

The next step is to work on reducing RAM usage itself.

Some applause from the audience? :smiley:


This is a new feature in the Web IDE which should already be available to everyone!

I just see 'Code verified! Great work.' / 'Ready.'

Am I doing something wrong ?

You need to just change the code each time you compile to see the ram usage.

Like just add in a SPACE will do the trick too :wink:

That does not work for me…

I have NEVER seen anything other than ‘Code verified! Great work.’ / ‘Ready.’

Since we’ve got a new firmware, it might be useful adding the faulty firmware version to this topic title, to avoid confusion.
@mhwlng, would you mind trying out a different browser? Maybe that’s where the problem lies.

I tried Chrome (latest) and Internet Explorer 11 and Firefox (latest)

I only ever see ‘Code verified! Great work.’ which then disappears after a few seconds and gets replaced by ‘Ready.’

You might need to clear your browser cache or do a hard refresh, but you should see a little “( i )” icon after that text or after the ready if it’s there. You need to change your file slightly to force it to recompile.


I cleared the cache,
I tried a browser that I never used before (firefox)

I just see ‘Ready.’ without the ‘i’ symbol.

Hi @mhwlng,

At the moment, it’s not there every time, just after fresh compiles when you change some code and click Verify. I just tried Firefox 29, and it worked, so I would think it would work for you as well, probably just a matter of timing. :slight_smile:


When I start a NEW project (fork blinking led), then it works…

None of my existing web ide projects, ever show an ‘i’

Hmm, weird! I’ll ping @jgoggins and maybe we can dig in and see what’s up!


Hey @mhwlng , that is weird indeed. The ‘i’ doesn’t show up for you even after you add a newline to your code then hit verify? And only happens for old projects? So strange. I couldn’t replicate. Does it happen in a Chrome incognito window after a fresh login?

1 Like

I think it now works.

just adding a new line or a space and pressing verify doesn’t show the 'i’
but actually changing the code (e.g. adding a new variable) does show the ‘i’

Thanks for your help

1 Like

Cool, no problem @mhwlng , I’m glad it’s working for you now! You had me stumped :smile: .