When are reference properties (DependencyProperty) released?

Let's say I want to create a connected property that binds a list of object references to a view instance (DependencyObject / FrameworkElement) ...

When does it issue all these links? Will it call Dispose on nested property values ​​if they implement it?

+3
source share
2 answers

It might be easier to think that “links” are never “freed”. They simply fall into bewilderment and can no longer be found, following any chain of links from global space or any stack of threads. Then they are considered garbage, and at some point the collector will come and collect the memory that they occupy. If they have finalists, they do not collect the memory right away, but put the object in a queue that will first cause finalization.

A FrameworkElement should not, for various reasons, call Disposefor any link stored in the dictionary of values ​​when it is unloaded. First of all, because he cannot know that he is responsible for this.

, , . , , , framework , ?

, , .

+2

- DependencyObjects. ( ), . , , . .

0

Source: https://habr.com/ru/post/1771876/


All Articles