Freeing up Memory

90% of the Flash memory and over half of the RAM memory are devoted out of the box to the WIFI stack, Bootloader, and the rest of the firmware. Is thee anyway to free up some of this memory?

For example, if all I want to do is to be able to use the Particle IDE and use Arduino style libraries, and do not need WiFI, is there anyway to free up the memory? Can I remove the WiFi contribution to the memory usage?

You could use:

SYSTEM_MODE(MANUAL);

Thank you. So that will free up some RAM only, right? Is there anyway to free up any of the flash memory?

1 Like

Are you hitting the limit on flash memory? How large is your project?

No, it is for a future project. I would like to free up as much Flash as possible to make sure I never run out of memory. I would basically just like to have the firmware allow me to use the Particle IDE to use Arduino style code. I do not need Wifi for this project.

1 Like

I’m not really sure what else you can do besides write more optimized code. @rickkas7 might know some ways to free up memory.

Frankly you shouldn’t worry about running out of memory at this point in time. There is adequate flash memory for most projects.

OK, thanks for the input. I do see that you can Expand the application flash region to 384K and forgo OTA updates. What is the procedure for doing this?

1 Like

If you aren’t going to use Wi-Fi or the Particle cloud, and you need a lot of flash for code, I wouldn’t actually use the Photon. I’d use Arduino on ESP32. The Adafruit HUZZAH32 - ESP32 Feather has 4 MB flash, a 240 MHz dual core processor, and 520KB RAM. If you’re going to be writing code that requires a lot of flash memory or processor capabilities and don’t need to use the Particle cloud, that’s the way I’d go.

That being said, you can get up to 384K of flash memory for user code by using a monolithic build for Photon and only flashing by USB.

And these tips are useful for optimizing the size of your code, both flash usage and RAM usage.

6 Likes

Since we’re reccomending other IoT boards I’d reccomend the Feather HUZZAH ESP8266 which is pretty great as well.