Skip to content

BTGridPager keeps creating new Fragment instances without deleting the old one #2

Description

@neilsheps

@btate -

Thanks for a great piece of code. I'm implementing some pretty heavy Fragments and getting OOM errors after a while. It looks like it's generating more Fragments than it's destroying.

As an example, if we assume the cell 4,1 in a 5x5 matrix is the heavyweight Fragment, and I assign a static variable "instances" which i increment in the Fragment's onCreateView(), decrement it on onDestroyView(), Logcat shows me that when I scroll around, the variable instances keeps growing, and only occasionally decrements when I'm far enough away from cell 4,1.

I suspect it's something to do with the pre-fetching either side of the active cell. Any ideas? I can poke around, but couldn't quite figure it out.

Neil

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions