Yet another blog about WPF, Surface, SL, MVVM, NUI.... - Tag - Dynamic http://blog.lexique-du-net.com/index.php? In this blog we talk about WPF, Natural User Interface(NUI), Microsoft Surface, WIndows 7, Multitouch, Touchless, JavaFX, MVVM, patterns, tips, tricks .... and a lot of other things ! en Mon, 26 Feb 2024 15:40:43 +0100 Jonathan ANTOINE, All rights reserved http://blogs.law.harvard.edu/tech/rss Dotclear What ? Dynamic resources creates Memory leaks in WPF 3.5 (SP1) ??? http://blog.lexique-du-net.com/index.php?post/2011/03/27/What-Dynamic-resources-creates-Memory-leaks-in-WPF-3.5-%28SP1%29 urn:md5:20f78de56ffc9f29719df87fb78511c5 Sun, 27 Mar 2011 08:12:00 +0200 JonathanANTOINE@falsemail.com WPF DynamicleakmemoryperformanceResourcestipstrickWindows Presentation FoundationWPF <p style="margin-top: 0; ">Everyone is told to not use DynamicResource during its childhood in WPF-(wonder)land. They are simply evil and they kill the app performance. Sometimes, we fall in the dark side of the force and use them effectively to be sure that the application will follow the trend and suits itself well. This is not as bad as it seems and it is in fact sometimes necessary and wanted.</p> <p>&nbsp;But today, while I was trying to improve the performance and the memory usage of a WPF application I work on, I discovered that they were also creating memory leaks! I felt betrayed. I was using them and they put a knife in my back while I trusted them to be useful.&nbsp;</p> <p><br /><strong>In this post we will see how it can happens, and how to solve this (little) issue.</strong></p> <p>I was not alone in this situation and I found out that there were both a work-around and an hotfix available. Here is the information I gathered.   Description of the problem When you create and load a ResourceDictionary, the objects you add inside are actually not created immediately. They are referenced in the form of an instance of an object... <a href="http://blog.lexique-du-net.com/index.php?post/2011/03/27/What-Dynamic-resources-creates-Memory-leaks-in-WPF-3.5-%28SP1%29"><em>Read</em> What ? Dynamic resources creates Memory leaks in WPF 3.5 (SP1) ???</a></p> http://blog.lexique-du-net.com/index.php?post/2011/03/27/What-Dynamic-resources-creates-Memory-leaks-in-WPF-3.5-%28SP1%29#comment-form http://blog.lexique-du-net.com/index.php?post/2011/03/27/What-Dynamic-resources-creates-Memory-leaks-in-WPF-3.5-%28SP1%29#comment-form http://feeds.feedburner.com/JonathanAntoine/comments/74