I have a proyect and im using a SiPy to develop it, when i add a couple of new files to the proyect i tried to run the proyect to see that doesn't affect the proyect itself, but suddenly a
MemoryError: Memory Allocation failed, allocating 136 bytes
rised on the atom terminal, about a line that imports another class of the proyect, one that doesn't interfere with the new added.
I search a lot of information about it and i see some possibilities about allocate bytecode on the flash or something like that (sorry for bad expressions, not even my first year as software developer), and i tried to format my flash to clean the board (with os.fsformat("/flash")) and uploading it again to find out i have the same error.
if i comment that import line i catch the same error later on another import of an imported class also and so on...
I don't really know if there is some easy troubleshooting but i've been stuck for a week with this problem and i am out of ideas.
print("Thanks people").
Memory Error, Memory Allocation Error of 136 bytes when trying import
- Charlython
- Posts: 1
- Joined: Tue Jun 23, 2020 10:56 pm
Re: Memory Error, Memory Allocation Error of 136 bytes when trying import
It sounds like it's running out of RAM trying to compile and the module that is being imported.
The feature you're looking for is called "frozen modules" and it lets you pre-compile python code as bytecode into the firmware image. Which port and board are you using?
For the "main" MicroPython ports (STM32, ESP32, ESP8266, etc) you'll need to write a manifest.py describing which files to use. I'm not sure the equivalent thing for the PyCom boards, but it would be worth asking in the PyCom forums.
The feature you're looking for is called "frozen modules" and it lets you pre-compile python code as bytecode into the firmware image. Which port and board are you using?
For the "main" MicroPython ports (STM32, ESP32, ESP8266, etc) you'll need to write a manifest.py describing which files to use. I'm not sure the equivalent thing for the PyCom boards, but it would be worth asking in the PyCom forums.
Re: Memory Error, Memory Allocation Error of 136 bytes when trying import
For the Pycom firmware you have to put your files into the folder frozen/Custom. Then they will be included into the flash during the build process.