Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Memory leak in the example #3

Open
romoloman opened this issue Aug 13, 2022 · 1 comment
Open

Memory leak in the example #3

romoloman opened this issue Aug 13, 2022 · 1 comment

Comments

@romoloman
Copy link

romoloman commented Aug 13, 2022

In the first example the following handler generates a memory leak:

server->on("/upload", HTTP_POST, [](AsyncWebServerRequest *request) {
request->send(200);
}, handleUpload);

it should be written as

server->on("/upload", HTTP_POST, [](AsyncWebServerRequest *request) {
}, handleUpload);

Handling the response in the handleUpload function.

Otherwise request->send() clear the request while is still in use in the handleUpload() and then heap is never recovered....

@smford
Copy link
Owner

smford commented Sep 25, 2022

@romoloman are you able to raise a PR with your proposed fix please, it would be nice to include it in

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

No branches or pull requests

2 participants