khoih-prog / Portenta_H7_AsyncTCP

Asynchronous TCP Library for STM32H7-based Portenta_H7 using mbed_portenta core. This library is the base for future and more advanced Async libraries, such as AsyncWebServer, AsyncHTTPRequest and AsyncHTTPSRequest
GNU Lesser General Public License v3.0
7 stars 3 forks source link

Async Web Server - using Strings, and consuming ++ heap space - when sending large blocks of data / web page #3

Open salasidis opened 2 years ago

salasidis commented 2 years ago

I do not have access to an ESP32 board, but I used the AdvancedAsyncWebServer example to demonstrate the issue.

On the default program, I added some code to print the heap size, and I increased the graph array from 50 to 500 points.

On the modified program, I created a C string instead of an Arduino String, and sent the same 500 line graph svg file

There is a word file that shows the outputs, and the outputs demonstrate that if sending an Arduino String, the software requires 2x extra heap space on top of the the actual string size.

If sending a C string, it takes 3x.

My proposal is to have an option (separate call, or modify the current ones), that can use the c string as is, and simply pre and post append to it any headers and footers required, without creating new Arduino Strings in the library

(having trouble posting ZXIP file - will try after submit this)

Here is a link to the ZIP file - 2 arduino sketches (one the default one - with only the minor changes listed above, and the other with the C string use) - ? could not upload the file directly

https://1drv.ms/u/s!At0Rrq6KzAeZheBLHtfLiaYglHDtLA?e=gegmIb