Repository navigation
Conversation
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.
Problem
createStore().disconnect(id)iterates forward overlistenersandsplice()s every match. Oneconnect({a, b})registers two listeners with the same id. After the first one is removed, the second shifts into indexiand the loop skips it, so the listener for the second key is never removed.WindowThumbnailconnects{scrollActive, thumbnailCloseButtonOffset}to the applet-widestate, so every destroyed thumbnail stays referenced from the applet's listener list forever: thethumbnailCloseButtonOffsetclosure keeps the thumbnail and everything it references alive. The same happens to other multi-keyconnect()calls ongroupStatefor as long as the app group lives.Impact
Found while investigating periodic desktop stutter on Linux Mint 22.3 / Cinnamon 6.6.9 / cjs 115.1. After 33 days of uptime the live JS heap (
imports.system.dumpMemoryInfo()→gcBytes) was 329 MB. Since cjs schedules a non-incremental "big hammer" GC on toggle-down, which on a live desktop fires every ~10 s, the compositor was blocked 200–234 ms every 10 s (a forcedimports.system.gc()took 215 ms). After restarting Cinnamon: 6 MB heap, 7 ms GC. A heap dump showed several leaks; the biggest one is #13956 (fix in #13958), this is another one.The heap dump after 33 days had 4,246 live
thumbnailCloseButtonOffsetclosures, all held through the store's listener list.Reproduce
In Looking Glass:
Fix
Iterate backwards. Verified on 6.6.9 by running the applet with this change: the snippet above returns 0, and the window list works normally.
🤖 Generated with Claude Code