cgicc-help
[Top][All Lists]
Advanced

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

[Cgicc-help] [help-cgicc] File upload memory usage


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

[1] https://lists.gnu.org/archive/html/help-cgicc/2018-03/msg00000.html
[2] https://lists.gnu.org/archive/html/help-cgicc/2015-10/msg00000.html
[3] https://lists.gnu.org/archive/html/help-cgicc/2010-09/msg00000.html

Attachment: cgicc-3.2.16-memopt.patch
Description: Binary data


reply via email to

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