Skip to content

fix(forms #70627): prevent eager materialization of signal form children during garbage collection - #70633

Closed
seshan18 wants to merge 1 commit into
angular:mainfrom
seshan18:main
Closed

seshan18 wants to merge 1 commit into
angular:mainfrom
seshan18:main

Conversation

@seshan18

@seshan18 seshan18 commented Sep 9, 2026 •

Copy link
Copy Markdown

Closes : #70627

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Currently, the lazy instantiation logic for Signal form fields (introduced in 98c5afdb) is inadvertently bypassed. The field management garbage collection effect in manager.ts calls structure.children() while tracking live structures. Calling .children() internally triggers ensureChildrenMap(), which recursively forces the entire form tree to materialize synchronously in the next event loop tick.

When initializing a form with a massive data array (e.g., thousands of items), this synchronous eager materialization locks the main thread and causes the browser to crash with a SIGILL (out-of-memory) error.

Issue Number: #70627

What is the new behavior?

The markStructuresLive function in manager.ts now uses structure.materializedChildren() instead of structure.children().

This ensures that the garbage collector only crawls nodes that have already been instantiated. This fully preserves the laziness intended by the previous optimization commit and prevents out-of-memory crashes on forms containing massive datasets, without altering any functionality.

Does this PR introduce a breaking change?

  • Yes

  • No

@pullapprove
pullapprove Bot requested a review from kirjs September 9, 2026 09:21
@google-cla

google-cla Bot commented Sep 9, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@seshan18 seshan18 changed the title Fixes #70627 prevent eager materialization of children in field manag… fix(forms #70627): prevent eager materialization of signal form children during garbage collection Sep 9, 2026
@angular-robot angular-robot Bot added the area: core Issues related to the framework runtime label Sep 9, 2026
@ngbot ngbot Bot added this to the Backlog milestone Sep 9, 2026
@seshan18 seshan18 closed this by deleting the head repository Sep 16, 2026
@angular-automatic-lock-bot

Copy link
Copy Markdown

This pull request has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Oct 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area: core Issues related to the framework runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Signal form children initialization is not really lazy

1 participant