-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix: Clear the "view" to avoid left over referenced once the View is detached and should be collected by GC #6353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| public onUnloaded(): void { | ||
| this.unsubscribeFromDynamicUpdates(); | ||
| this.view = undefined; | ||
| this._matchInvalid = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This variable is poorly named. "Match invalid = false" implies that the match is valid, but you're about to set the match to undefined, which strikes me as ultimately invalid. It is usually best to name boolean variables as the "positive"; i.e. change the naming of the variable to _matchValid so that you're not doing gymnastics to understand double-negatives.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
|
@VladimirAmiorkov, could you please rebase your branch on master, since there are a lot of important fixes. |
…detached and should be collected by GC
e639a66 to
3212837
Compare
|
@SvetoslavTsenov Yes of course. Done. |
|
|
I noticed a couple of other things that could be a source of this memory leak. I will investigate them now and get back at you. |
|
Hi @vakrilov , After researching this issue today I am unable to observe it even without any fixes in the I suggest we close this PR for now since I can no longer observe an memory leak when working with the latest version (^4.2.1) of tns-core-modules and/or with the next version. |
|
On a side note: It may be nothing but I noticed that in the CssState class we are subscribing to one event here and unsubscribing from a different one here, meaning we subscribe to |
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
PR Checklist
What is the current behavior?
When using the Angular
createEmbeddeedViewfrom theViewContainerRef, after callingclear()the created NativeScript Views are left in the memoryWhat is the new behavior?
When using the Angular
createEmbeddeedViewfrom theViewContainerRef, after callingclear()the created NativeScript Views are collected by the GC and a no longer in the memoryFixes/Implements/Closes #[Issue Number].
ProgressNS/nativescript-ui-feedback#825