how to chomp with memoryview? #14088
Unanswered
kjm1102
asked this question in
Using MicroPython
Replies: 1 comment 3 replies
-
This appears to be a continuation of https://github.com/orgs/micropython/discussions/14080 ? Probably best to keep the discussion in one place. I don't believe there is a way to just reduce the size of an existing bytearray without a copy being made, (micro)python doesn't really work that way. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've setup a 20k bytearray and used memoryview to fill 18k of it with bytes from a modem. But now I need to chomp through selectively deleting stuff, starting with the unused to 2k at the end of the bytearray, without running out of ram.
Memoryview will let me selectively alter bytes in the array but I can't seem to remove any with it. If I try slicing out the data I get memory allocation errors. Is there a way to reduce a 20k bytearray down to ~17.7k without using another 17.7k of ram to do it?
Beta Was this translation helpful? Give feedback.
All reactions