Memory Leak in PropertyGrid when Rearranging Controls

未关闭
#64 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
38/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
csharp
领域
desktop

调研方向

使用提供的 XAML 和大纲面板中的拖放步骤复现 Demo.XamlDesigner 中的内存泄漏。首先检查 PropertyGrid.Reload 以及相关的 PropertyNode 保留情况,然后比较注释掉 Reload 时的内存行为;当重复重新排列不再导致进程内存增长时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

Hello,
I think I found a memory leak. Here are the steps to reproduce it on Demo.XamlDesigner:

  • run Demo.XamlDesigner app
  • in the XAML tab, paste the following code:
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Width="640"
        Height="480">
  <Canvas>
    <TabControl Width="304"
                Height="167"
                Canvas.Left="72"
                Canvas.Top="132">
      <TabItem />
      <TabItem />
      <TabItem />
      <TabItem />
      <CheckBox />
    </TabControl>
    <CheckBox Canvas.Left="157" Canvas.Top="233.04000000000002" />
    <CheckBox Canvas.Left="242" Canvas.Top="208" />
    <CheckBox Canvas.Left="157" Canvas.Top="173.04000000000002" />
    <CheckBox Canvas.Left="234" Canvas.Top="158" />
    <CheckBox Canvas.Left="116" Canvas.Top="208" />
  </Canvas>
</Window>
  • switch to Design view
  • in the outline panel, drag and drop the tab items and check boxes onto each other randomly
  • see the process memory consumption increase

Here is the screen recording video of this process.

If you comment out the PropertyGrid.Reload method body, the problem seems to disappear. This this might be PropertyNode - related. However, I was unable to track down the object retention problem to fix it.

主要语言
C#
星标
1.1k
派生
281
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

icsharpcode/WpfDesigner 的其他 Issue

查看 icsharpcode/WpfDesigner 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。