memory optimization tips for esp8266
Posted: Fri May 19, 2017 2:19 am
Hi Everyone,
Being a c++ and embedded newbie I have put best of my efforts to develop the following codebase:
https://github.com/debojitk/WifiDoorLock
Details of the project are listed here:
https://hackaday.io/project/13478-smart ... -door-lock
Recently I started working on security implementation on the connections, so I tried to use Websockets library by Links2004, and used wss protocol. Now the problem is when I am using plain websocket (no ssl) the available memory is ~12kb. Whenever I change it to use wss the connection itself fails ad the esp restarts. The obvious reason being the wss implementation itself that uses WifiClientSecure api behind the scene. I tested with a sample sketch that every wss connection eats up up to 10-11kb memory. With 3 connections created I am left with 10kb memory.
So it is very obvious that using wss with my existing code will fail as is has got only 11 kb left.
Its a humble request to you all to have a look at my codebase ad suggest some fine tuning or design changes to optimize memory usage or any alternate way to implement security.
Thanks in advance.
Debojit
Being a c++ and embedded newbie I have put best of my efforts to develop the following codebase:
https://github.com/debojitk/WifiDoorLock
Details of the project are listed here:
https://hackaday.io/project/13478-smart ... -door-lock
Recently I started working on security implementation on the connections, so I tried to use Websockets library by Links2004, and used wss protocol. Now the problem is when I am using plain websocket (no ssl) the available memory is ~12kb. Whenever I change it to use wss the connection itself fails ad the esp restarts. The obvious reason being the wss implementation itself that uses WifiClientSecure api behind the scene. I tested with a sample sketch that every wss connection eats up up to 10-11kb memory. With 3 connections created I am left with 10kb memory.
So it is very obvious that using wss with my existing code will fail as is has got only 11 kb left.
Its a humble request to you all to have a look at my codebase ad suggest some fine tuning or design changes to optimize memory usage or any alternate way to implement security.
Thanks in advance.
Debojit