Online connection drops if the code is too large

Hello everyone,

I am facing this problem with the spark core as well as with the arduino (with CC3000). I am running a MQTT client based on the library from knolleary. However, how do I know the RAM usage in my program?

This is because, code compiles and uploads successfully, but it does a publish and reboots. If I cut down a section of the code, it works fine.

So am I running out of RAM, or the MQTT client is not able to handle the payload., or a problem with CC3000.??

PS: My code receives 16 bytes of data via serial port, 8 bytes gives me two temperature parameters, each bit of 3 bytes gives me specific alarms, rest are ignored. I converted each of them into one meaningful string and published that via MQTT.

Thanks,
Gaurav

How are you compiling your code?
Usually you get a mem summary from the compiler - even the WebIDE (aka Sparkulator) does give you this info, when you click on “(i)” at the bottom of the screen after you compile.
Unfortunately this symbol disappears after some seconds and is not at all displayed if you recompile unchanged code.
Otherwise you might see something like

Output of arm-none-eabi-size:

text	data	bss	dec	hex
76448	1332	11892	89672	15

In a nutshell:
Flash used	77780 / 110592	70.3 %
RAM used	13224 / 20480	64.6 %

Does it do a red SOS flash as it reboots? may be a clue in there too…

@Hootie81 … exactly…

Hi @gaurav

What @Hootie81 meant was that the pattern of red flashes will tell you what is wrong and then you can debug. See this for details:

http://docs.spark.io/troubleshooting/#troubleshoot-by-color-flashing-red