'Reallocating large String(... -> ...)' warning when using WebServer
Hi,
since PR #8821 I get this output from ESP8266WebServer:
[String] 'Content-Ty ... ires: -1
': Reallocating large String(140 -> 162 bytes)
It's from this line
https://github.com/esp8266/Arduino/blob/be02af0504869e2bf119a013fe8fd6cf5ed8e411/libraries/ESP8266WebServer/src/ESP8266WebServer-impl.h#L433
if sendHeader() is used more than once. Like here:
https://github.com/khoih-prog/ESP_WiFiManager_Lite/blob/085afdbd7ccfb7e46b1ed9f1cf5c50be29cc3223/src/ESP_WiFiManager_Lite.h#L2771
Is there something we can do against it?
Thanks for having revealed an internal misuse of strings. Fixing this is on us.
If you are using the git version of this core, can you try with #8873 ?
(or the unofficial "nightly" alpha release)
As written in #8873 the change in ESP8266WebServer looks good to me.
There is similar issue in ESP8266HTTPClient https://github.com/esp8266/Arduino/blob/6ad9bf3b07ecbe8dd34623c8f81db3b7614cffbf/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp#L820 if you add multiple headers ...
The output appears also in the published version 3.1.2 when DEBUG_ESP_PORT is enabled even when Debug Level == none.
Example:
[String] 'Content-Ty ... rigin: *
': Reallocating large String(159 -> 183 bytes)
[String] 'Content-Ty ... ep-alive
': Reallocating large String(183 -> 209 bytes)