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

Fix memory leak in fontSize cache #4119

Merged
merged 1 commit into from
Aug 10, 2023
Merged

Conversation

dweymouth
Copy link
Contributor

Description:

The fontSizeCache which stores size information for a given string and font size+style was only cleaned out on settings change. Since it stores arbitrary strings from user code it would be a slow leak over time especially for text-heavy apps.

This PR makes the cache entries expire with the standard expiry time and adds the cleanup to the Clean task that is run on paint events. I am open to discussion if the cleaning should be done on a different schedule and/or the expiry should be adjusted.

Fixes #4108

Checklist:

  • Tests included.
  • Lint and formatter run with no errors.
  • Tests all pass.

Where applicable:

@dweymouth dweymouth linked an issue Aug 2, 2023 that may be closed by this pull request
2 tasks
@coveralls
Copy link

Coverage Status

coverage: 65.087% (+0.004%) from 65.083% when pulling 6f83e00 on dweymouth:fix-4108 into c66a184 on fyne-io:develop.

@dweymouth dweymouth requested a review from Jacalz August 9, 2023 15:52
Copy link
Member

@andydotxyz andydotxyz left a comment

Choose a reason for hiding this comment

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

Good catch thanks

@dweymouth dweymouth merged commit b0ef254 into fyne-io:develop Aug 10, 2023
11 checks passed
@dweymouth dweymouth deleted the fix-4108 branch August 10, 2023 16:02
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 leak in font metrics cache
3 participants