Reputation: 1187
I'm trying to track down some memory leaks in my application and according the the ANTS profiler, many of my objects are being help up by System.Windows.Threading.Dispatcher. My application is basically single threaded and the only explicit calls I make to Dispatcher.Invoke are unrelated to the objects being held up. The objects do seem to all be UserControl children of a FixedDocument subclass of mine, if that means anything to anyone.
What is causing the dispatcher to not release my objects?
Upvotes: 2
Views: 1429
Reputation: 25623
There is an operation scheduled on the dispatcher (e.g., with BeginInvoke
), and one of the arguments to that operation references your ReportVisualTable
, either directly or indirectly.
Looking at the types included in your retention graph, it looks like a DocumentViewer
attempted to bring a page into view, but the page hadn't been loaded yet, so the operation was deferred on the dispatcher. The operation was enqueued at priority level Inactive
, which means it will just sit in the queue indefinitely, because that priority level is never processed. When the requested page is loaded, the operation's priority is bumped up to Background
, but if that never happens, it seems the operation will just stay inactive.
Upvotes: 4