Code: Select all
line 195 OSError: [Errno 12] ENOMEM
So I decided to see if I could free up the ~12k of ram, I tried my idea in the repl
Code: Select all
>>> import gc; gc.collect(); gc.mem_free()
110176
>>> with open('code.mpy', 'r') as f: tram=f.read()
...
>>> import gc; gc.collect(); gc.mem_free()
98112
>>> tram=0
>>> import gc; gc.collect(); gc.mem_free()
109472
Suitably emboldened I tried the idea in my user code, re-assigning the ram I'd used to hold code.mpy prior to writing it to flash.
Code: Select all
import gc; gc.collect(); print('free mem before', gc.mem_free())
tram=0
gc.collect(); print('free mem after', gc.mem_free())
Code: Select all
free mem before 76304
free mem after 76308