Page 1 of 1

microwebsrv2 : not enought memory !

Posted: Mon Feb 01, 2021 7:13 am
by JacquesC
Hello,
I am a teacher and I have an automatism project with students
I have to run the web server and the management of the model in parallel.
Before I was using version 1 of microwebsrv (thanks JC BOS ;-) but as I have to manage in parallel the running of the model, I prefer use the version 2.
I'm using an ESP32 WROOM but I still get the same error message:
---------------------------
- Python pkg MicroWebSrv2 -
- version 2.0.6 -
- by JC`zic & HC2 -
---------------------------

Traceback (most recent call last):
File "<stdin>", line 3, in <module>
File "MicroWebSrv2/__init__.py", line 18, in <module>
File "MicroWebSrv2/microWebSrv2.py", line 8, in <module>
File "MicroWebSrv2/httpRequest.py", line 8, in <module>
MemoryError: memory allocation failed, allocating 444 bytes
>>>
Has anyone managed to run it on this ESP32 or is it necessary to use an ESP32 WROVER?
Thank you
Jacques C.

Re: microwebsrv2 : not enought memory !

Posted: Mon Feb 01, 2021 11:07 am
by Divergentti
I don't have experience of that module, but I have hit to same problem with other classes.

Have you tried gc.collect() prior to code execution?

Re: microwebsrv2 : not enought memory !

Posted: Mon Feb 01, 2021 12:06 pm
by PythonKai
Hello Jacques,

I have the same problem and unfortunaty I couldn't solve it.
For my project I use the first version of MicroWebServer and works very well.

Kai

Re: microwebsrv2 : not enought memory !

Posted: Mon Feb 01, 2021 2:16 pm
by VladVons
indeed microwebsrv2 is not a micro.
it has over 4000 lines of source code.
on esp32 should work, but memory info needed to say something.

perhapse your download file is too big to fit in memory and server loads it into memory instead of splitting into portions of streaming.

Memory usage:
import gc
gc.collect()
print("free", gc.mem_free())
print("alloc", gc.mem_alloc())

Device type:
import sys
print("platform", sys.platform)