[ fix ] : fix memory leaks and standardize subscription lifecycle in v0.9#994
Open
Dijo-404 wants to merge 6 commits intogoogle:mainfrom
Open
[ fix ] : fix memory leaks and standardize subscription lifecycle in v0.9#994Dijo-404 wants to merge 6 commits intogoogle:mainfrom
Dijo-404 wants to merge 6 commits intogoogle:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request implements a comprehensive signal lifecycle management system to prevent memory leaks across the Angular, React, and web_core renderers. Key changes include the introduction of signal reference counting in the DataModel, explicit disposal methods for bound properties, and improved cleanup logic for dynamic values and function calls. Feedback suggests simplifying subscription management in the Angular ComponentHostComponent by directly using the subscription object within the cleanup callback to remove unnecessary class properties.
fd2a25c to
4baa44f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #963 — Addresses critical memory leaks and standardizes subscription lifecycle management across the A2UI
web_coreand Angular renderer. This PR prevents unbounded memory growth in long-lived surfaces and eliminates leaked background processes (e.g., timers) when components unmount or properties update.What's Fixed
DataModel.signalscache: Added reference counting to evict unused signal entries and prevent unbounded Map growth.FormatStringleaks: Tracked and disposed of all recursive signals created inside format strings (e.g.,${now()}).DataContextunsubscribe chain: Properly propagatedunsubscribeownership for signals returned by function implementations.ComponentBinderscoping: MovedDestroyRefinjection to component scope to prevent application-lifetime subscription leaks.ComponentModel.onUpdatedto refresh component properties when the protocol updates them.Testing
AbortSignallisteners and internal Maps are cleared on component unmount.Verification
Note
There is an lint error in
src/v0_9/catalog/types.test.tswhich i haven't touched, its due unused variables, let me know should i fix that and push it in this pr itself or i need to put it as an issue and issue another pr fixing that