Advanced Users can post their questions and comments here for the not so Newbie crowd.

Moderator: eriksl

User avatar
By esp8266_abc
eriksl wrote:If you apply all I recommended, it isn't that bad. Please remember that there is very little hardware available for wireless handling. Many things, that usually are handled by a piece of hardware, must be processed by the cpu and so they WILL take memory. That is including a few frames of buffering, for both sending and receiving. Remember that every frame has to be encrypted or decrypted (using WPA AES), there is no hardware support there. Each wireless frame is about 2400 bytes, so you do the math...

Another place where you can buy yourself a lot of DRAM memory is the LWIP library. The version shipped with the SDK has a lot of buffer memory allocated to a number of sockets, tcp segment reassembly etc. It will take most of the memory from the heap so you won't see it in the linker output, but it will definitely decrease the amount of memory you can use. The way to go is to compile LWIP yourself, with only the options and sizes you're actually using. It can save you up to about 16 kbytes, not bad I think.

Then there is the ~2.5 kbytes somewhere that apparently is never used (at least not with my usage, the SDK never writes anything there). So I am using that for buffer memory as well, saves another 2.5 kB.

And finally, if you still think too little RAM is available and/or don't want to spend the effort to squeeze out every last bit, the the ESP8266 isn't really for you, I'd suggest using the ESP32 in that case. It has much more memory and it has a higher layer of abstraction in their IDK, which most people seem to like (and I personally hate).

It is! You said it! Well, I am trying to strip off those modules de-fact unused from SDK lib and override those functions with empty ones and saves a lot of dRam greatly :D