fix(memory): memory growth app side#97
Open
Times-Z wants to merge 2 commits intowayle-rs:masterfrom
Open
Conversation
ac46855 to
1998795
Compare
1998795 to
e65bcf4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
Resolve part of memory growth in the bar shell reported in issue #95, particularly when notifications and media player / systray activity are present
The investigation used heaptrack profiling across multiple runs (only in release mode) to isolate leaks and validate fixes
Solutions
Four targeted fixes addressed the major memory leak vectors in application code:
Systray CSS Provider
icon_color_provider_attachedflag toSystrayItemto attach the provider only onceNotification Icon Loading
load_scaled_file_icon()helper usinggdk_pixbuf::Pixbuf::from_file_at_scale+Texture::for_pixbufgdk-pixbufworkspace dependencySystray Icon Deduplication
IconSignatureenum to track when icons have actually changed (vs. redundant updates)update_icon()now compares signature and skips apply if unchangedBar Button Threshold Styling
ThresholdColorsactually changegtk_css_provider_load_from_stringcalls per session from threshold pollingValidation results from heaptrack profiling:
Remaining allocations (not actionable in this repo):
wayle_systrayexternal crate icon pixmap D-Bus polling (zvariant/zbus allocations)mem::forget(_guard)for log guard lifetime)Test Plan
cargo check -p wayle-shellpasses after each fixcargo build --release -p waylecompiles successfullycargo fmtandcargo clippy --workspacepass before mergeRemaining Work / Future Improvements
Fixes #95