I’ve been investigating a problem with a long running application that accumulates an apparently unbounded number of CVDisplayLink threads. I do not yet have an explanation or a test case.
The code that creates and releases CVDisplayLinks looks fine, but that assumes there are no threading issues. It looks like there are threading issues. Specifically, it appears that the startDisplayLink and stopDisplayLink methods of the Objective-C class MTLLayer are invoked on multiple threads. They are invoked on the AppKit main thread from screen sleep notifications and blitTexture. They are invoked on the EDT from MTLLayer.validate. They are invoked on the Queue Flusher thread from MTLRenderQueue.flushBuffer. Perhaps someone familiar with this code could comment?