Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

'Reallocating large String(... -> ...)' warning when using WebServer #8872

Open
hmueller01 opened this issue Feb 27, 2023 · 4 comments
Open

Comments

@hmueller01
Copy link
Contributor

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

_responseHeaders += headerLine;

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?

@d-a-v
Copy link
Collaborator

d-a-v commented Feb 27, 2023

Thanks for having revealed an internal misuse of strings.
Fixing this is on us.

@d-a-v
Copy link
Collaborator

d-a-v commented Mar 1, 2023

If you are using the git version of this core, can you try with #8873 ?

(or the unofficial "nightly" alpha release)

@hmueller01
Copy link
Contributor Author

As written in #8873 the change in ESP8266WebServer looks good to me.

There is similar issue in ESP8266HTTPClient


if you add multiple headers ...

@mcspr mcspr changed the title String Reallocating warning 'Reallocating large String(... -> ...)' warning when using WebServer Mar 20, 2023
@mathertel
Copy link
Contributor

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)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants