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

Implemented memory-sensitive cache for images #125

Merged
merged 3 commits into from
Jul 1, 2022
Merged

Conversation

a-sr
Copy link
Member

@a-sr a-sr commented Jun 23, 2022

The previous implementation held the ImageData and Image objects of all images ever used in Klighd in memory. This PR replaces the hard cache with a more memory-sensitive variant using weak references for ImageData and soft references for Image.

@a-sr a-sr requested a review from NiklasRentzCAU June 23, 2022 07:23
@a-sr a-sr marked this pull request as ready for review June 23, 2022 12:05
a-sr added 2 commits June 30, 2022 16:30
This implementation is less elegant but ensures that images are properly
disposed when their image data is no longer in use. It also tries to
decrease the impact on runtime performance by a timeout between clean up
runs.
Copy link
Member

@NiklasRentzCAU NiklasRentzCAU left a comment

Choose a reason for hiding this comment

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

Works well, I cannot reproduce any image resource-related memory leak anymore, all images get disposed eventually when they are not used anymore.

@NiklasRentzCAU NiklasRentzCAU merged commit 6df2df3 into master Jul 1, 2022
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.

2 participants