Skip to content

Fix memory issues with label reuse and use of bitmap label #19

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

Merged
merged 3 commits into from
Mar 8, 2021

Conversation

makermelissa
Copy link
Collaborator

Fixes #15. Apparently labels were getting recreated rather than just reused. The code was refactored to be a little more efficient as well.

@makermelissa makermelissa requested a review from a team March 4, 2021 18:48
@makermelissa makermelissa marked this pull request as draft March 4, 2021 18:51
@makermelissa
Copy link
Collaborator Author

Oops, I just noticed a bug in the code where text isn't changing.

@makermelissa makermelissa marked this pull request as ready for review March 4, 2021 19:59
@makermelissa
Copy link
Collaborator Author

I ended up reverting back to the old code because I was running into the max_glyphs error when longer text was used. I took a different approach and am only recreating the label if the text is longer, otherwise it's being reused. This is a bit more memory efficient as the act of creating the label uses up more memory than the unused space does when the text is shorter.

@makermelissa
Copy link
Collaborator Author

Ok, I've been running the quote board using this for about an hour without errors so far.

@makermelissa makermelissa changed the title Fix memory leak with label reuse Fix memory issues with label reuse and use of bitmap label Mar 5, 2021
Copy link
Contributor

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me thanks for the fixes to use less memory.

I tested these changes successfully on:

Adafruit CircuitPython 6.2.0-beta.3-36-g103632f44 on 2021-03-07; Adafruit PyPortal with samd51j20

Running the quotes, and Bitcoin price projects from Learn Guides everything is working well..

@makermelissa makermelissa merged commit 4941e40 into adafruit:main Mar 8, 2021
@ladyada
Copy link
Member

ladyada commented Mar 8, 2021

thanks for testing @FoamyGuy

adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Mar 9, 2021
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

Successfully merging this pull request may close these issues.

Memory allocation failed using adafruit_display_text.label
3 participants