|
From: | Martin Oberhuber |
Subject: | [Cgicc-help] [help-cgicc] File upload memory usage |
Date: | Wed, 27 Jun 2018 19:29:16 +0200 |
Hello Dries, dear cgicc users and maintainers - Like others before [1][2][3], I have also found cgicc to require an unreasonable amount of main memory when processing uploaded files. In my case (cgicc-3.2.16, gcc-4.8.1, ARM Linux) a 100MB uploaded file required 300MB main memory. I debugged the case and noticed that parseMIME() can easily avoid one of the two string::substring() usages, thus cutting down memory usage to 200MB. I didn't pursue it further than that, though I found Dries' arguments about copy-on-write in the string class very interesting. I suppose that c++17 string_view would also be interesting. I believe that my patch (attached) is simple, safe and fully portable and solves at least part of the problem. Could it be considered for a future cgicc release? Thanks, Martin |
cgicc-3.2.16-memopt.patch
Description: Binary data
[Prev in Thread] | Current Thread | [Next in Thread] |