Discuss here different C compiler set ups, and compiling executables for the ESP8266

User avatar
By mharizanov
#7222 Guys,
I seem to have heap issues, some of them related to SDK bugs like the one shown here:


As a result, I get a "malloc assert!" message and the module restarts; This happens when the heap drops below 10K

Any tips on how to reduce the heap usage so that I have more of it to start with? I've all of my functions prefixed with ICACHE_FLASH_ATTR, but am not sure if that forces any printf text inside to flash, or is it just the code?
Thanks
User avatar
By PuceBaboon
#7412 Martin,

I suspect you're miles past this point already, but as others have pointed out, some of the Makefiles floating round have the ifdef for dev-mode and prod-mode back to front. Changing the production compiler options to -O2 (and dropping the "-g") can have a significant impact on the size of your application.

-John-
User avatar
By jcmvbkbc
#7416
PuceBaboon wrote:Changing the production compiler options to -O2 (and dropping the "-g") can have a significant impact on the size of your application.

From my experience -Os generates smaller code (most of the code anyway comes from libraries, and btw code and data memories are separate in this CPU, so smaller code doesn't mean more space for the heap) and -g does not impact the size of loadable sections.