VirtualizingStackPanel memory leak if never shown

Halliday, Sean 6 Reputation points
2021-09-30T16:21:18.32+00:00

There appears to be a memory leak in the VirtualizingStackPanel where if it is never shown then the _cleanupDelay timer is running but will never stop because it is waiting on a measure that will never happen. I think it should call ClearAsyncOperations when it gets unloaded, doing it only when IsVisible changes is not enough.

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,709 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Brad Lindsay 1 Reputation point
    2022-07-06T07:49:18.39+00:00

    We've experienced the same issue. Setting VirtualizingStackPanel.VirtualizationMode="Recycling" does not help solve this problem. The dispatch timer keeps a reference to the VirtualizingStackPanel in memory causing it to be permanently retained.

    0 comments No comments