sinricpro / esp8266-esp32-sdk

Library for https://sinric.pro - simple way to connect your device to Alexa, Google Home, SmartThings and cloud
https://sinric.pro
228 stars 122 forks source link

Sinricpro using more heap memory how to reduce #209

Closed smartswitchsio closed 2 years ago

smartswitchsio commented 2 years ago

Please find the below heap size in serial output, Sinricpro using more heap memory how to reduce

Used example sketch : MultiSwitch_beginner.ino ....................connected! [WiFi]: IP-Address is 172.16.0.111 48192 48192 48192 48192 48192 Connected to SinricPro 17736 17736 17736 17736 17736 17736 17736 17736 17736 17736

sivar2311 commented 2 years ago

Most of the heap memory is unfortunately used by the underlying SSL encryption. Unfortunately, there is nothing we can do about that.

Currently there is still the option to use #define SINRICPRO_NOSSL (before including the library). This turns off the SSL encryption. But I don't know how long non-SSL connections are supported by the server.

smartswitchsio commented 2 years ago

If sinric pro connected to server taking more heap memory, not enough to load web page

sivar2311 commented 2 years ago

As already written, the memory is not consumed by the SinricPro library, but by the use of SSL. This is a limitation due to the underlying SSL libraries and the sparsely equipped ESP8266 with RAM. To illustrate this, here is a comparison between RAM consumption with SSL and without SSL:

SSL enabled

[WiFi]: connected
ESP.getFreeHeap():      46824
[SinricPro]: Connected
ESP.getFreeHeap():      18928

SSL disabled (#define SINRICPRO_NOSSL)

[WiFi]: connected
ESP.getFreeHeap():      46824
[SinricPro]: Connected
ESP.getFreeHeap():      46192

Perhaps you should consider the ESP32 for your project, which has considerably more RAM and should therefore meet your requirements:

ESP32 SSL enabled

[WiFi]: connected
ESP.getFreeHeap():      277112
[SinricPro]: Connected
ESP.getFreeHeap():      231092

For the sake of completeness, the ESP32 without SSL:

ESP32 SSL disabled (#define SINRICPRO_NOSSL)

[WiFi]: connected
ESP.getFreeHeap():      277424
[SinricPro]: Connected
ESP.getFreeHeap():      274568
stale[bot] commented 2 years ago

This issue has gone quiet. Spooky quiet. We currently close issues after 14 days of inactivity. It’s been at least 7 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. As a friendly reminder, the best way to fix this or any other problem is to provide a detailed error description including a serial log. Thanks for being a part of the SinricPro community!

stale[bot] commented 2 years ago

Hey again! It’s been 14 days since anything happened on this issue, so our friendly robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to comment on this issue or create a new one if you need anything else. As a friendly reminder, the best way to fix this or any other problem is to provide a detailed error description including a serial log. Thanks again for being a part of the SinricPro community!