Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4872

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

$
0
0
That is indeed correct, I use a piece of code that works, but uses memory very inefficiently.
i want to do this:

Code:

Q1:      [170,  255,  31,  15     .........up till (230 times)...........     63]convert to:row1:    [1,0,1,0,1,0,1,0, 1,1,1,1,1,1,1,1, 0,0,0,1,1,1,1,1, 0,0,0,0,1,1,1,1, .........up till (1840 times)........... 0,0,1,1,1,1,1,1]
and for that I use this piece of code that I got from the net, and of which I don't really know what exactly it does.
but its works.....................it just uses a lot of memory.

Code:

row1 = []for byte in Q1:# Q = rowbyte        for x in (128, 64, 32, 16, 8, 4, 2, 1):                 row1.append(int(bool(byte & x)))print("row 1",row1)


]

Statistics: Posted by trixo — Tue Nov 05, 2024 5:46 pm



Viewing all articles
Browse latest Browse all 4872

Trending Articles