help-cgicc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[help-cgicc] File upload memory usage


From: Dries Deschout
Subject: [help-cgicc] File upload memory usage
Date: Mon, 26 Mar 2018 13:21:39 +0000

Hello,


While upgrading compilers from GCC 4.7 to GCC 7.2 on an embedded device, I noticed a substantial increase in memory usage while parsing a file upload request.


This seems to be caused by changed behavior in std::string. As GCC 4.7 was using copy-on-write and refcounting for std::string, a string copy did not cause a copy of the data. Now with GCC 7.2, a string copy also copies the data. For some large (+30MB) requests, this now makes our application go out-of-memory on a embedded device with only 128MB of RAM.


To bring memory usage back to the GCC 4.7 values, I patched Cgicc::parseMIME to std::move the data to the FormFile and FormEntry (see attached patch).


As this patch is using some C++ 11 features, I was wondering if you do accept patches that (conditionally) use C++ 11 (or higher) features?

I could rework the patch to only use those features when supported by the __cplusplus version.


Best Regards,

Dries

Secure your future – Meet Newtec Dialog®, the platform that embraces change – with award-winning Mx-DMA®!
***mail confidentiality footer ***
This message and any attachments thereto are confidential. They may also be privileged or otherwise protected by work product immunity or other legal rules. If you have received it by mistake, please let us know by e-mail reply and delete it from your system; you may not copy this message or disclose its contents to anyone. E-mail transmission cannot be guaranteed to be secure or error free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore is in no way liable for any errors or omissions in the content of this message, which may arise as a result of e-mail transmission. If verification is required, please request a hard copy.

Attachment: 01-move-form-data.patch
Description: 01-move-form-data.patch


reply via email to

[Prev in Thread] Current Thread [Next in Thread]