FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Is there a memory problem with the owner references on android? · Issue #6913 · NativeScript/NativeScript · GitHub

Is there a memory problem with the owner references on android? #6913

Description

I'm researching a memory leak we have with nativescript-angular (NativeScript/nativescript-angular#1738) and I noticed a few things in NativeScript Core.

Why is the owner references on Android not a WeakRef like it is on iOS?

For instance if you look at the TouchListener added here:
https://github.com/NativeScript/NativeScript/blob/master/tns-core-modules/ui/core/view/view.android.ts#L416
This owner reference is not cleared when the View is destroyed, so there is circular reference between the touchListener and owner view.
On iOS the owner property would have been a WeakRef and there wouldn't have been a problem.

In my test project (NativeScript/nativescript-angular#1738 (comment)) this results in many leftover Label objects:

The screenshot is after forcing 100 redraws of a ListView with ~22 items, resulting in ~2200 Label objects.

I could submit a PR fixing this for the touchListener so the owner reference is cleared, but before that I'd like to understand why android views don't use a WeakRef to the owner like the iOS views do?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL