Repository navigation
Conversation
Every CVDisplayLinkStart spawns a fresh io thread, and windows unsubscribe whenever frame requests park. A timer-driven animation (a 30 Hz spinner) parks between every frame, so the link was stopped and restarted per frame: a new thread per frame (~88 in 3 s in a 30 Hz probe). Keep a display's link running for 250 ms after its last subscriber leaves. A subscriber that returns within the linger reuses the running link; a generation counter makes stale deferred stops no-ops. Idle windows still stop the link shortly after parking. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
CVDisplayLinkStartspawns a fresh io thread. Windows unsubscribe from their display's link whenever frame requests park (pause_frame_requests). A timer-driven animation, like a 30 Hz spinner, parks between every frame, so the link was stopped and restarted once per frame: one new thread per frame.STOP_LINGER) after its last subscriber leaves:LinkState:Measurements
A probe window redrawing on a 30 Hz timer, sampled for 3 s with
/usr/bin/sampleand countingCVDisplayLinkthreads:In a real app (Zeron) with a sidebar spinner running, a 2 s sample showed 25
CVDisplayLinkthreads come and go.Test plan
cargo test -p gpui_macos --lib display_link: 5 newLinkStatetests covering:cargo clippy -p gpui_macos: no warnings indisplay_link.rs🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.