angular-docs-cn/packages/core/test/acceptance
Kristiyan Kostadinov 18b33e79d3 perf(core): avoid storing LView in __ngContext__ (#41358)
Currently we save a reference to an `LView` on most DOM nodes created by Angular either by saving
the `LView` directly in the `__ngContext__` or by saving the `LContext` which has a reference to
the `LView`. This can be a problem if the DOM node is retained in memory, because the `LView` has
references to all of the child nodes of the view, as well as other internal data structures.

Previously we tried to resolve the issue by clearing the `__ngContext__` when a node is removed
(see https://github.com/angular/angular/pull/36011), but we decided not to proceeed, because it can
slow down destruction due to a megamorphic write.

These changes aim to address the issue while reducing the performance impact by assigning a unique
ID when an `LView` is created and adding it to `__ngContext__`. All active views are tracked in
a map where their unique ID is used as the key. We don't need to worry about leaks within that map,
because `LView`s are an internal data structure and we have complete control over when they are
created and destroyed.

Fixes #41047.

PR Close #41358
2021-04-26 09:31:41 -07:00
..
BUILD.bazel refactor(core): add debug ranges to `LViewDebug` with matchers (#38359) 2020-08-06 16:58:11 -07:00
attributes_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
bootstrap_spec.ts fix(core): unsubscribe from the `onError` when the root view is removed (#39940) 2020-12-03 13:44:17 -08:00
change_detection_spec.ts fix(core): Ensure OnPush ancestors are marked dirty when events occur (#39833) 2020-11-25 14:39:19 -08:00
change_detection_transplanted_view_spec.ts fix(core): clear the `RefreshTransplantedView` when detached (#38768) 2020-09-10 09:11:38 -07:00
common_integration_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
component_spec.ts perf(core): avoid storing LView in __ngContext__ (#41358) 2021-04-26 09:31:41 -07:00
content_spec.ts docs: update links to use HTTPS as protocol (#39718) 2020-11-20 12:52:16 -08:00
copy_definition_feature_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
debug_spec.ts perf(core): avoid storing LView in __ngContext__ (#41358) 2021-04-26 09:31:41 -07:00
di_spec.ts feat(core): support `forwardRef` in `providedIn` of `Injectable` declaration (#41426) 2021-04-06 10:03:38 -07:00
directive_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
discover_utils_spec.ts perf(core): avoid storing LView in __ngContext__ (#41358) 2021-04-26 09:31:41 -07:00
embedded_views_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
exports_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
host_binding_spec.ts fix(compiler): incorrectly interpreting some HostBinding names (#40233) 2021-01-07 13:15:46 -08:00
i18n_spec.ts perf(core): avoid storing LView in __ngContext__ (#41358) 2021-04-26 09:31:41 -07:00
inherit_definition_feature_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
integration_spec.ts fix(compiler): not generating update instructions for ng-template inside alternate namespaces (#41669) 2021-04-20 09:44:44 -07:00
lifecycle_spec.ts fix(core): error if detectChanges is called at the wrong time under specific circumstances (#40206) 2020-12-22 14:52:12 -08:00
listener_spec.ts fix(compiler): preserve this.$event and this.$any accesses in expressions (#39323) 2020-10-30 10:49:15 -07:00
ng_module_spec.ts refactor(compiler): move factory out of injector definition (#41022) 2021-03-08 15:31:30 -08:00
ngdevmode_debug_spec.ts perf(core): avoid storing LView in __ngContext__ (#41358) 2021-04-26 09:31:41 -07:00
ngmodule_scope_spec.ts fix(core): prevent NgModule scope being overwritten in JIT compiler (#37795) 2020-08-11 09:50:27 -07:00
outputs_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
pipe_spec.ts fix(compiler): evaluate safe navigation expressions in correct binding order (#37911) 2020-08-11 09:51:10 -07:00
profiler_spec.ts perf(core): add private hooks around user code executed by the runtime (#41255) 2021-04-02 10:34:23 -07:00
property_binding_spec.ts fix(compiler): don't report parse error for interpolation inside string in property binding (#40267) 2021-01-05 13:57:23 -08:00
property_interpolation_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
providers_spec.ts refactor(compiler): implement `ngDeclareInjectable()` (#41316) 2021-04-07 13:57:13 -07:00
pure_function_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
query_spec.ts fix(core): Switch `emitDistinctChangesOnlyDefaultValue` to true (#41121) 2021-03-12 10:47:56 -08:00
renderer_factory_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
router_integration_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
security_spec.ts fix(core): fix possible XSS attack in development through SSR (#40525) 2021-01-26 09:32:27 -08:00
styling_spec.ts fix(compiler): handle case-sensitive CSS custom properties (#41380) 2021-03-30 16:57:44 -07:00
template_ref_spec.ts fix(core): allow EmbeddedViewRef context to be updated (#40360) 2021-02-23 08:14:01 -08:00
text_spec.ts fix(compiler): handle strings inside bindings that contain binding characters (#39826) 2020-12-10 11:11:21 -08:00
view_container_ref_spec.ts fix(core): fix multiple nested views removal from ViewContainerRef (#38317) 2020-08-13 13:35:53 -07:00
view_insertion_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
view_ref_spec.ts fix(core): memory leak if view container host view is destroyed while view ref is not (#40219) 2021-01-08 09:45:12 -08:00