WPF performance and. NET Framework client profile

Source: Internet
Author: User

Origin: http://blogs.msdn.com/ B /jgoldb/archive/2010/06/14/memory-leak-hotfixes-for-wpf-3-5-sp1.aspx

 

 

Hopefully folks saw my related blog post finding memory leaks in WPF-based applications.
In this post below I wanted folks to be aware that we released few other kb articles (hotfix) that address other varous memory leaks reported in. net 3.5 SP1. some of these fixes made it. net 4.

1. kb981107 (See:Http://support.microsoft.com/kb/981107)

This hotfix fixes the following memory leaks in. net 3.5 SP1 WPF-based applications.
Issue 1 :
This affects an app that contains styles or templates that refer to application resources (via staticresource or dynamicresource ), and that creates a large number of elements that use these styles or templates but never need the actual value of the resource. in this situation, the app can leak deferredappresourcereference objects, even after the elements themselves have been reclaimed. (In addition, the app can leak weakreferences and array space, similar to the issues described below .)

An example: app resources define 20 This creates a resource that's used by any control that can display a horizontal scrollbar. creating a large number of such controls that never actually display their scrollbar will encounter the leak.

Issue 2:
This affects an app that creates a large number of short-lived elements with properties that are data-bound to a dependencyproperty of longer-lived elements. in this situation, the longer-lived elements maintain lists of weakreference objects, used to sort y the short-lived elements about property changes. the app can leak weakreference objects and the array space to hold them, even after the short-lived elements have been reclaimed.

An example: listboxitem binds its horizontalcontentalignment property to a similar property on its governing ListBox. an app that creates a large number of listboxitems (say by doing a large number of additions and deletions to the ListBox's itemssource) will encounter the leak.

Issue 3 :
this issue affects classes derived from Treeview or selector (including ListBox, listview, menu, DataGrid, and other others ). these classes register for an internal notification from the keyboardnavigation class, used for controlling keyboard focus. an app that creates a large number of these elements can leak weakreference objects and the array space to hold them, even after the elements themselves have been reclaimed.
An example: an app that creates a large number of short-lived listboxes will encounter the leak. this can happen in a nested scenario, where an outer ListBox displays a collection that undergoes a large number of additions and deletions, and where each item is displayed using an inner ListBox.

These fixes areNotIncluded in net4. we are considering this hotfix also for net4, but this demo-has not been made, so stay tune.

2. kb967634:(See: Http://support.microsoft.com/kb/967634)

This fixes a memory leaks in. Net 3.5 SP1 WPF-based applications when using software 3D rendering involving a visualbrush or drawingbrush.
This fix is already writable ded in. Net 4.

3. kb967328(See: http://support.microsoft.com/Default.aspx? Kbid = 967328)

This hotfix fixes memory leaks when a deferred resource isn't inflated due to the resource reference expression hooking up toInflatedEvent on the resource dictionary entry.
If the resource dictionary is an application or theme dictionary, then these are essential global and can cause these expressions to stay alive.
There are some discussions on this issue here.
This fix is already writable ded in. Net 4.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.