ESPASyncWebServer Out of Memory Errors

I am using ESPAsyncWebServer on a NODEMCU. On some web pages, I get random failure to load on one or more files. By turning on all debug output options, I now see "oom" (out of memory) errors, originating at line 301 of WebRespnses.cpp, which is a line that is attempting to malloc a buffer for sending a response to the client. This is triggered whenever there are more than about 6 files to be sent, or one or more of the files are rather large. Transferring large files (MUCH larger then available RAM) is no problem, as they get automatically "chunked". Rather, it appears to be the number of simultaneous file downloads that causes the problem.

Surely there is SOME way to get around this? Perhaps some way to restrict the number of simultaneous requests?

How much memory is it trying to allocate? How much do you have left when a page request comes in?

The failing requests are different sizes, though none are particularly large - a few kB each. You can see the ":oom" errors here:

setup() done @838 mSec

add 1
aid 1
station: f0:d5:bf:a8:d0:77 join, AID = 1
beginResponse(/topmenu.html)
AsyncFileResponse(/topmenu.html:2156)
Sent: /topmenu.html:
beginResponse(/tach.jpg)
AsyncFileResponse(/tach.jpg:35973)
Sent: /tach.jpg:image/jpeg
beginResponse(/oil.jpg)
AsyncFileResponse(/oil.jpg:36039)
Sent: /oil.jpg:image/jpeg
beginResponse(/temp.jpg)
AsyncFileResponse(/temp.jpg:30566)
Sent: /temp.jpg:image/jpeg
bright.png start
beginResponse(/bright.png)
AsyncFileResponse(/bright.png:14228)
Sent: /bright.png:image/png
bright.png done
beginResponse(/volt.jpg)
AsyncFileResponse(/volt.jpg:375776)
:oom(1568)@?
Sent: /volt.jpg:image/jpeg
favicon.ico start
beginResponse(/favicon.ico)
AsyncFileResponse(/favicon.ico:4286)
Sent: /favicon.ico:image/ico
favicon.ico done
beginResponse(/topmenu.html)
AsyncFileResponse(/topmenu.html:2156)
Sent: /topmenu.html:
beginResponse(/oil.jpg)
AsyncFileResponse(/oil.jpg:36039)
Sent: /oil.jpg:image/jpeg
beginResponse(/tach.jpg)
AsyncFileResponse(/tach.jpg:35973)
Sent: /tach.jpg:image/jpeg
beginResponse(/temp.jpg)
AsyncFileResponse(/temp.jpg:30566)
Sent: /temp.jpg:image/jpeg
beginResponse(/volt.jpg)
AsyncFileResponse(/volt.jpg:375776)
Sent: /volt.jpg:image/jpeg
bright.png start
beginResponse(/bright.png)
AsyncFileResponse(/bright.png:14228)
:oom(2920)@WebResponses.cpp:301
Out of Memory: 0/2920!
Sent: /bright.png:image/png
bright.png done
:oom(3084)@WebResponses.cpp:301
Out of Memory: 0/3084!
:oom(1568)@?
:oom(1568)@?
:oom(1568)@?
station: f0:d5:bf:a8:d0:77 leave, AID = 1
rm 1

I reduced the number of errors by reducing the MAX_FILES define in LittleFS.cpp, but they still occur far too often.

I have (barely) the option of switching to ESP32, which has >5X more memory, which I suspect would eliminate the problem. That may be the path of least resistance.

Anyone know how much of an effort it would be t switch from ESP12E/MODEMCU to ESP32? I'm suspecting it should be fairly minor? The only "hardware dependent" code I have, outside of the AsyncWebServer, is a very simple interrupt-driven tachometer function using the second timer.