Skip to content

Conversation

Dwordcito
Copy link
Contributor

@Dwordcito Dwordcito commented Sep 2, 2025

Memory optimization in POST method handling

  • Improved buffer management to avoid multiple reallocations when processing large POST requests
  • This change reduces memory fragmentation and improves performance for applications that handle substantial POST data

@Dwordcito
Copy link
Contributor Author

@yhirose proxy test was broken in another PR.

@yhirose
Copy link
Owner

yhirose commented Sep 2, 2025

@Dwordcito, thanks for the pull request. However, I am not going to merge it because this modification affects a request handler with ContentReceiver. In this case, res.body will not be used at all, but this change allocates unnecessary memory.

  svr.Post("/content_receiver", [&](const Request &, Response &res,
                                    const ContentReader &content_reader) {
    content_reader([&](const char *data, size_t data_length) {
      // Handle `data` without pushing it to `res.body` at all.
      return true;
    });
  });

@yhirose yhirose closed this Sep 2, 2025
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

Successfully merging this pull request may close these issues.

2 participants