Skip to content
This repository was archived by the owner on Jul 28, 2020. It is now read-only.
This repository was archived by the owner on Jul 28, 2020. It is now read-only.

ArFragment leaking after parent activity finished #1087

@0xGuybrush

Description

@0xGuybrush

Issue

I was trying to track down a memory leak with ArFragment in my app so I created a minimal, complete, verifiable example here (Git repo).

It looks like with no other code installed, ArFragment is still leaking when its parent activity is closed.

Symptoms

Leak Canary is just showing:

GC Root: global variable in native code

leak-canary-screenshot

I've examined the hprof file (zipped, attached here) and it seems like there's still a reference to the Fragment in its Scene's onUpdateListeners and onPeekTouchListeners:

Seems to still be a reference from Scene's listeners?

But I may not be reading that accurately — Do we need to do additional tear-down for the ArFragment before exiting the activity? Referencing the sample code here, it doesn't look like I'm missing anything else & I've literally stripped out all other interaction with the fragment apart from resuming/pausing it.

Context

Dependencies

Using:

implementation 'com.google.ar:core:1.16.0'
implementation 'com.google.ar.sceneform.ux:sceneform-ux:1.15.0'
implementation 'com.google.ar.sceneform:core:1.15.0'

But was also occuring with AR Core 1.15.0

Device

I'm seeing this on Android 10 / Nokia 8.1


Please let me know if you need more info.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions