turfptax / ugit

Micropython OTA update from github
GNU General Public License v3.0
136 stars 24 forks source link

out of memory #21

Open keredson opened 1 year ago

keredson commented 1 year ago

I'm sure this is an obvious/known issue, but I hit an OOM with a pretty small repo (8 files, 3 commits):

>>> import ugit
>>> gc.mem_free()
87088
>>> ugit.pull_all()
Use: like ugit.wificonnect(SSID,Password)
otherwise uses ssid,password in top of ugit.py code
Wifi Connected!!
SSID: xxxxxxxx
Local Ip Address, Subnet Mask, Default Gateway, Listening on...
('10.0.0.54', '255.255.255.0', '10.0.0.1', '75.75.75.75')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "ugit.py", line 66, in pull_all
  File "ugit.py", line 174, in pull_git_tree
  File "urequests.py", line 116, in get
  File "urequests.py", line 62, in request
OSError: [Errno 12] ENOMEM

image

this line:

  tree = json.loads(r.content.decode('utf-8'))

micropython really needs an incremental json parser...

turfptax commented 1 year ago

It is interesting that if you have an active REPL session with the microcontroller it will give this error frequently but when it is just running the code without a REPL session this has gone away. Does anyone know of a decent way to fix this issue?

I just rebooted my device and powered it without connecting to a computer and it ran well but that is not a fix and more like a band-aide.

SilverLogix commented 1 year ago

I have a whole TON of fixes I'm working on for you.