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

MicroPython • Re: Slicing bytearray without copying it, possible?

$
0
0
There's 'MemoryView' or something like that. I have never used it and am not convinced it doesn't copy. And I am not convinced there is what you want from when I last dipped into looking at doing similar.

You can determine the addresses of 'bytearray' data, use offsets into that. You probably need to be looking at creating your own Native C Module for an optimal solution or maybe considering DMA.

There's also 'gc.collect' which will force garbage collection which may help but frame buffers are usually large, which severely impacts on the amount of memory free for processing other data. In this respect MicroPython on an RP2040 isn't the ideal tool for the job.

Statistics: Posted by hippy — Fri May 03, 2024 10:39 pm



Viewing all articles
Browse latest Browse all 5852

Trending Articles