Memory usage in recent releases

Hi.

We are building a product using the P1.

I started having an issue claiming development devices recently and have just tracked it down to low available memory.

With 0.6.3 System.freeMemory() reports back in the area of 31000 bytes free.
However running the same application but compiling against 0.7.0 or 0.8.0-rc.3 free memory reports back between 700 to 1200 bytes free.

The result of this for me was that when I went to claim my device and I went into listening mode and attached to the P1, there was not enough memory for (presumably) the SoftAP to run (as reported under 0.8.0-rc.3 generating out_of_memory system events).

Has there been some deliberate change that could explain this, or is this an unnoticed bug?

Has anyone else seen this?

edit: I’m compiling locally if that is relevant.

Thanks.

Newer version of system firmware will have less free memory due to added features, but the difference should not be that great.

I ran this minimal program, built with the CLI cloud compilers and run on a Sparkfun Photon Red Board (which is actually a P1).

#include "Particle.h"

void setup() {
	Serial.begin(9600);
}

void loop() {
	Serial.printlnf("freeMemory=%u", System.freeMemory());
	delay(5000);
}

And got these results:

  • P1 0.5.5 freeMemory=63860
  • P1 0.6.3 freeMemory=61820
  • P1 0.7.0 freeMemory=53288
  • P1 0.8.0-rc2 freeMemory=52912

It’s possible that if you’re using different features you’d have a bigger difference, but it should not be 30K. It should be less than 10K.

For local builds, make sure you’re using gcc-arm 5.3.1 (5-2016-q1-update) of the gcc-arm compiler. That’s the one used for cloud builds for 0.7.0 and later and is the recommended version.

1 Like

Thanks Rick.

Yes that’s the compiler version I’m using. I’ve followed the local compiling guide from the Particle site for my setup.

I’ll do some investigation and see if I can figure out what feature I’m using that’s eating up all of my available memory on >= 0.7.0.