You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: DevTools inspector still uses ~9 MB more memory per 100 selections after the comment-box fix #1283
Follow-up to #1277. With the DevTools inspector window open, every selection still adds memory. That's about 9 MB per 100 selections, and it doesn't level off.
The fix for #1277 (commit 7259839 on branch zateutsch-fix-inspector-selection-memory-growth, not merged yet) removes reference cycles in the comment box. That cut the growth roughly in half, from about 18 MB to about 9 MB per 100 selections. This issue tracks the rest.
Cause: each selection throws away the whole details pane and parses a new one from markup. The pane is the right side of the inspector with the property rows, the Layout and XAML sections, the filter, and the comment box. Experiments showed that even a plain pane with no event handlers still grows memory when it is added to the window and then removed. The DevTools tap's own bookkeeping stays flat. So the remaining growth seems to come from XAML or XamlDiagnostics (the WinUI service DevTools uses to watch the app's controls) keeping state for each rebuilt pane.
Likely fix: build the pane once and update it in place on each selection, instead of parsing and replacing it. That means reusing the controls, rebinding the property rows (they already use an ItemsRepeater), and updating the header, Layout section, source actions and comment box. This is a redesign of ShowPropsForNode in src/winapp-devtools/native/WinApp.DevTools.Native/DevToolsWindow.PropsPane.inc and how it wires the pane.
To Reproduce
winapp run .\samples\winui-app --devtools on --detach --json # note the processId
winapp devtools call Window.open -a <pid>
winapp devtools search CounterButton -a <pid>--json # repeat for 3–4 element names to get handles# select the handles in turn 400 times:
winapp devtools call Selection.select handle=<handle>-a <pid>
Private memory of the app, with the #1277 fix applied (Windows 11 Arm64):
Selections
Private memory
start
76.5 MB
50
107.0 MB
100
111.8 MB
200
121.6 MB
300
131.2 MB
400
139.9 MB
With the inspector window closed, memory stays flat. Selecting the same element again doesn't add memory.
Expected behavior
After warmup (the first ~50 selections), memory stops growing no matter how many selections are made.
Screenshots
N/A
OS Version and details
Windows 11 Arm64. winapp built from main plus the #1277 fix.
What is wrong:DevToolsSinkBase is a small COM object that receives XAML events. Its reference counting doesn't really count: AddRef() returns 2 and Release() returns 1, so a sink never deletes itself. ShowPropsForNode creates new sinks with new every time it rebuilds the pane.
Show me: select 100 elements. Each rebuild runs code like new LostFocusSink() (Editors.inc:965). The old pane goes away, but its sinks, the strings they store, and their free-threaded marshalers stay in memory. Expected: a pane's sinks are freed along with it.
Why it matters: memory grows steadily for as long as the app runs. This likely explains part of the ~9 MB per 100 selections that remains. Each sink is small, and the problem existed before Fix DevTools inspector memory growing with each selection #1285.
Smallest fix: give each pane's sinks a real lifetime and release them when the pane is replaced. If the pane is redesigned to be reused, new sinks wouldn't be created on every selection.
Activity
Fix DevTools inspector memory growing with each selection (#1285)
zateutsch commentedon Nov 5, 2026
Another possible source of the remaining growth, from Chiara Mooney (@chiaramooney)'s review of #1285:
Event sinks created per selection are never freed
DevToolsSinkBaseis a small COM object that receives XAML events. Its reference counting doesn't really count:AddRef()returns 2 andRelease()returns 1, so a sink never deletes itself.ShowPropsForNodecreates new sinks withnewevery time it rebuilds the pane.new LostFocusSink()(Editors.inc:965). The old pane goes away, but its sinks, the strings they store, and their free-threaded marshalers stay in memory. Expected: a pane's sinks are freed along with it.src\winapp-devtools\native\WinApp.DevTools.Native\DevToolsSink.h:19-20Source: #1285 (comment)