Skip to content

[TECHNICAL] Resource leaks in fragment bindings #4813

Closed

Description

@joragua

Currently, not all existing fragments are properly clearing their view bindings when the view is destroyed. This can lead to memory/resource leaks, especially in cases where the fragment lifecycle outlives its view lifecycle.

  1. Identify fragments where bindings are not being cleared
  2. Update those fragment using the following approach:
override fun onDestroyView() {
    super.onDestroyView()
    _binding = null
}

⚙️ Resources

Important

Don't forget to follow all comments described in the issue: branch name, defined approach...

TASKS

  • Research (if needed)
  • Create branch technical/binding_resource_leaks
  • Development tasks
    • Set to null all bindings in onDestroyView() method
  • Code review and apply changes requested
  • Design test plan
  • QA
  • Merge branch technical/binding_resource_leaks into master

Activity

  1. added this to the 4.8 - Current milestone on Mar 26, 2026
  2. corevibe555 commented on Mar 31, 2026

    @corevibe555
    Contributor

    @joragua I would love to work on this.

    Task 1. Research:
    I found 10 fragments have _binding but never set it to null in onDestroyView(), causing memory leaks when the view is destroyed but the fragment instance survives.

    Fragments That Need Fixing:

    -----------------------------------
    SpaceMembersFragment
    SpacesListFragment
    SetSpaceIconDialogFragment
    CreateSpaceDialogFragment
    AddMemberFragment
    RemoveFilesDialogFragment
    MainEmptyListFragment
    CreateShortcutDialogFragment
    FileDetailsFragment
    1SharesFragment
    ----------------------
    

    Each fragment needs an onDestroyView() override added:

    override fun onDestroyView() {
    super.onDestroyView()
    _binding = null
    }

  3. corevibe555 commented on Mar 31, 2026

    @corevibe555
    Contributor

    Comment task follow up:
    Branch name: technical/binding_resource_leaks
    Set to null all bindings in onDestroyView() method: Done
    Design Test plan:
    Manual testing done, reached the fragments via manual testing:
    SpaceMembersFragment Spaces → select a space → Members
    SpacesListFragment Spaces tab
    SetSpaceIconDialogFragment Spaces → edit space → set icon
    CreateSpaceDialogFragment Spaces → create new space
    AddMemberFragment Spaces → Members → Add member
    RemoveFilesDialogFragment Select file(s) → Delete
    MainEmptyListFragment Open an empty folder
    CreateShortcutDialogFragment Create shortcut action
    FileDetailsFragment Tap a file → file details
    SharesFragment File details → Shares tab

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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions