angular - Why Aren't FormControl#valueChanges' Subscriptions Garbage Collected?
问题描述
I have gone through plenty of threads saying that one needs to unsubscribe from FormControl#valueChanges
to prevent memory leaks. I understood the "when" and "how" to unsubscribe from Observable
s. As I understand, Observables that produce infinite number of values need to be unsubscribed and FormControl#valueChanges
is one such Observable
.
But my question is, why aren't these Observables
s garbage collected? I mean when an Angular component gets destroyed, the references are dead right? The form control in the template is no longer there. The FormControl
instance is also gone. So if the "source" of the Observable
, the FormControl
, is gone then how come its member valueChanges
still exist and retain its subscriptions?
解决方案
推荐阅读
- c++ - 返回对绑定到临时的引用参数的引用时悬空引用
- java - 在java中使用axis2分块soap Web服务?
- swift - 如何快速更改日期格式 2021-30-06T05:00:00+07:00?
- java - Spring(引导)URL 冲突(由于包含)
- java - Netty Eventloop 在“keventWait”上被阻止
- .net-core - 使用启动配置文件运行的 Dotnet 不转发 commandLineArgs
- flutter - 如何使用 Paint() 在颤振中创建圆角矩形?
- android - 如何在 appState 更改时重新加载 react-native-webview 内容
- r - 计算 R data.table 中的值向量
- python - 如何只调用一次打印?