Skip to content

Memory leak in the example #3

@romoloman

Description

@romoloman

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....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions