MaterialDesignInXAML / MaterialDesignInXAML/MaterialDesignInXamlToolkit

Using the button's animation effect caused a memory leak

Ouverte
#3,282 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

bug evaluation required
Langage dominant
C#
Étoiles
16.3k
Forks
3.5k
Merge moyen
1 j 22 h
PR mergées (30 j)
8

Description

### Bug explanation

[Machine translation, simple proofreading only]

greeting,Today I encountered a memory leak problem in using MaterialDesign, the details of the problem are as follows:
In some runtime environments (see file [ComputerInfos.txt] for computer configuration)(This behavior is not encountered in my development environment),If and only if the window state is maximized (and has not changed to another state),When the IsIndeterminate property of a button with Style="{StaticResource MaterialDesignRaisedButton}" (no other styles tested) is set to true.Each time the animation effect loops, the memory usage will increase by 3~5MB until it crashes or switches the window state.
Hovering and leave from such buttons also results in an increase in memory usage, which is the same as the effect described above.
If you switch the window state to non-maximized before the crash, the abnormally occupied memory will be freed and will not occur even if it is set to maximize again later.
When the memory is exhausted, an error is reported as shown in the [Error message] in the picture.
All Nuget packages used in the program are shown in the picture [NugetList1, 2, 3].

Regarding the video showing this problem, I put it on youtube because it exceeded the upload size limit, please visit the following two links to view it, or contact my email 2410600421@qq.com and I will send it to you as an attachment.

[中文原文]

大家好,今日在使用[MaterialDesign中遇到了内存泄漏的问题,问题详细情况如下:
在某些运行环境中(计算机配置详见文件[ComputerInfos.txt])(此现象并未在我的开发环境中遇到),当且仅当窗口状态为最大化时(且未曾更改为其他状态),将Style="{StaticResource MaterialDesignRaisedButton}"的按钮(未测试其他样式)的IsIndeterminate属性设置为true时。动画效果每次循环,内存占用将增加3~5MB,直到崩溃或者切换窗口状态。
鼠标悬浮和离开此类按钮,同样会造成内存占用增加,效果与上述效果一致。
如果在崩溃前将窗口状态切换为非最大化,那么异常占用的内存将会被释放,即使之后再次设置为最大化,这个问题也不会出现。
内存耗尽时,报错如图片[Error message]所示
程序内使用的所有Nuget包如图片[NugetList1、2、3]所示

关于展示此问题的视频,由于超出了上传大小限制,我将其放在了youtube上,请访问以下两个链接来查看,或者联系我的邮箱2410600421@qq.com,我将以附件的形式给您发送。

[图、文、视频资料] [Text, pictures, video materials]

![Error message](https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/assets/84267336/f20effa2-f0e9-41eb-ad3c-002cd587e6a5)
![NugetList1](https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/assets/84267336/dea5c90a-9790-430c-a49d-47faf745b2e9)
![NugetList2](https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/assets/84267336/b724b350-c7f7-4e16-a202-1
![NugetList3](https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/assets/84267336/a09367da-7f4e-4769-872c-cbc4819edef1)
5e077130230)

[ComputerInfos.txt](https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/files/12167773/ComputerInfos.txt)

https://youtube.com/shorts/PT4MLnNCSo4?feature=share
https://youtube.com/shorts/0R7E03ghs_s?feature=share

[部分代码][Part of the code]

private void RefernceImageSet_1_Btn_Click(object sender, RoutedEventArgs e)
{
if (bGetLicense)
{
_region.Activate(_ReferenceImage);
JobSingleton.Instance.NowWindowsNum = 0;

//ButtonProgressAssist.SetIsIndeterminate(RefernceImageSet_1_Btn, true);
//ButtonProgressAssist.SetIsIndeterminate(ModelSetting_Btn, false);
//ButtonProgressAssist.SetIsIndeterminate(RunSet_1_Btn, false);
//ButtonProgressAssist.SetIsIndeterminate(ParamSet_1_Btn, false);
}
}
When I comment out part of the code, the exception takes up memory and disappears, so I presume that it is a problem with MaterialDesign.
当我注释部分代码之后,异常占用内存的情况就消失了,故推断是MaterialDesign的问题。

### Version

4.0.0

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par reproduire le rapport de la ComputerInfos.txt fournie et le code du bouton affiché, en utilisant MaterialDesignRaisedButton avec IsIndeterminate activé lorsque la fenêtre est maximisée. Comparez l’utilisation de la mémoire entre les boucles d’animation et les événements de survol/quitte, puis vérifiez que la modification de l’état de la fenêtre ne libère plus la fuite signalée et ne l’empêche plus.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
csharp
Domaine
desktop, performance
Type d'issue
Bug
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.