Quantcast
Viewing all articles
Browse latest Browse all 4872

MicroPython • Re: MemoryError: memory allocation failed, allocating 153600 bytes

I'm running into a similar problem. The focused lines of code that I am noting are:

self.wd = EPD_WID
self.ht = EPD_HIT
self.sz = self.ht * self.wd // 4
print(gc.mem_free())
self.buf = bytearray([0xff] * self.sz)

Where EPD_WID = 280 and EPD_HIT = 480

theoutput log shows
MPY: soft reboot
182256
Traceback (most recent call last):
File "<stdin>", line 219, in <module>
File "<stdin>", line 32, in __init__
MemoryError: memory allocation failed, allocating 33600 bytes

My confusion is if I do the gc.mem_free just before the call to allocate, why is there insufficient memory for the call?

Statistics: Posted by jachaney — Sat Sep 14, 2024 5:41 pm



Viewing all articles
Browse latest Browse all 4872

Trending Articles