Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add buffer option for storing bitmaps to prevent out memory due to fragmentation. #44

Open
kmatch98 opened this issue Mar 10, 2021 · 1 comment

Comments

@kmatch98
Copy link
Contributor

For the case of sequentially loading large bitmaps and then freeing them from memory, it can sometimes cause the RAM to get fragmented so there is no contiguous chunk of memory large enough to hold the next bitmap:

MemoryError: memory allocation failed

It could be useful to have a way to define a bitmap "buffer" into which you can load a bitmap, and prevent memory segmentation. This would have to accommodate the varying color depth ("bits_per_pixel") of bitmaps or require this to be an input when creating the bitmap buffer. This buffer could be added as an optional input parameter to the adafruit_imageload.load function to direct it where to store the loaded bitmap.

@kmatch98
Copy link
Contributor Author

The new bitmaptools.readinto function may help with this: https://circuitpython.readthedocs.io/en/latest/shared-bindings/bitmaptools/index.html#bitmaptools.readinto

This needs some exploration to verify the best way of using it, and an example will be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant