Page 1 of 1

MemoryError: memory allocation failed, allocating %u bytes

Posted: Sat Jul 14, 2018 10:37 pm
by MorseIot
When you try to run file (test.py) with size of 18447 bytes, the error is generated:

Code: Select all

MemoryError: memory allocation failed, allocating %u bytes
When I split the same, it runs correctly. Is there any limitation of file size (py), or command that can bypass this situation

Re: MemoryError: memory allocation failed, allocating %u bytes

Posted: Sun Jul 15, 2018 7:07 am
by pythoncoder
I suggest you read this part of the docs.

Re: MemoryError: memory allocation failed, allocating %u bytes

Posted: Sun Jul 15, 2018 9:13 pm
by MorseIot
Thanks Peter Hinch, iam read the doc.

I need help using mpy-cross or use frozen bytecode

Re: MemoryError: memory allocation failed, allocating %u bytes

Posted: Mon Jul 16, 2018 10:11 am
by pythoncoder
To use frozen bytecode you need to be able to build the firmware. Instructions are here. Once you can successfully build and flash a firmware build, freezing bytecode is done by putting your Python source in ports/esp8266/modules/, building and flashing.
Issuing

Code: Select all

>>> help('modules')
will list modules successfully frozen.

Re: MemoryError: memory allocation failed, allocating %u bytes

Posted: Tue Jul 17, 2018 3:04 pm
by MorseIot
Ok

Thanks

Re: MemoryError: memory allocation failed, allocating %u bytes

Posted: Wed Jul 18, 2018 6:36 pm
by Roberthh
Just in case you use Windows, I keep a version of mpy-cross.exe here: https://github.com/robert-hh/Shared-Stuff

Re: MemoryError: memory allocation failed, allocating %u bytes

Posted: Tue Jul 24, 2018 1:41 am
by MorseIot
Thanks Roberthh