Skip to content

[LeakScope] 46 Android lifecycle/memory violations detected #979

Description

LeakScope: Android Lifecycle & Memory Leak Violations

About this report: This issue was automatically generated by LeakScope, a static analysis tool for Android lifecycle violations and memory leaks built on the Soot framework. This is part of an ongoing academic research study targeting ICSE 2027. No immediate action is required — we would greatly appreciate your feedback on whether these findings are accurate.

Summary

LeakScope detected 46 potential issue(s) across 4 detector type(s):

Severity Count
🔴 High 46
🟡 Medium 0
🟢 Low (improvement opportunity) 0
Detector Count Severity Description
FragmentViewFieldRetentionLeak 28 🔴 High Fragment stores View references in instance fields not cleared in onDestroyView()
StateHolderLeak 16 🔴 High Static field holds UI/Context reference across configuration changes
ThreadedUIReference 1 🔴 High Worker thread captures Activity/Fragment/View reference
ViewModelContextReference 1 🔴 High ViewModel stores Activity/Context reference causing memory leak

Detailed Findings

🔴 FragmentViewFieldRetentionLeak

Fragment stores View references in instance fields not cleared in onDestroyView()

Finding #1LocationsBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.LocationsBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetListSelectionBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #2InputBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.InputBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetInputBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #3ShortcutsBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.ShortcutsBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetShortcutsBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #4FeedbackBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.FeedbackBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetFeedbackBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #5ProductsBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.ProductsBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetListSelectionBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #6StoresBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.StoresBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetListSelectionBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #7ShoppingListClearBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.ShoppingListClearBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetShoppingListClearBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #8DateBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.DateBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetDateBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #9ProductGroupsBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.ProductGroupsBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetListSelectionBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #10LanguagesBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.LanguagesBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetListSelectionBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #11QuickModeConfirmBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.QuickModeConfirmBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() does not clear all View fields

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetScanModeConfirmBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #12ChoreEntryBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.ChoreEntryBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetChoreEntryBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #13TaskEntryBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.TaskEntryBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() does not clear all View fields

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetTaskEntryBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #14StockLocationsBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.StockLocationsBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetStockLocationsBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #15TextEditBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.TextEditBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetTextEditBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #16DrawerBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.DrawerBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetDrawerBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #17TaskCategoriesBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.TaskCategoriesBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetListSelectionBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #18CompatibilityBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.CompatibilityBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetCompatibilityBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #19QuantityUnitsBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.QuantityUnitsBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetListSelectionBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #20StockEntriesBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.StockEntriesBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetStockEntriesBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #21InputProductBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.InputProductBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetInputProductBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #22ShoppingListItemBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.ShoppingListItemBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetShoppingListItemBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #23StockEntryBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.StockEntryBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetStockEntryBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #24TextBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.TextBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetTextBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #25UsersBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.UsersBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetListSelectionBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #26ShoppingListsBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.ShoppingListsBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() does not clear all View fields

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetListSelectionBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #27BarcodeFormatsBottomSheet

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.bottomSheetDialog.BarcodeFormatsBottomSheet

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentBottomsheetBarcodeFormatsBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

Finding #28MealPlanPagingFragment

Fragment View Field Retention Leak Detected
Class: xyz.zedler.patrick.grocy.fragment.MealPlanPagingFragment

Issue:
- Fragment stores View references in instance fields
- These fields are not cleared when the view is destroyed

- onDestroyView() is missing

Leaked Fields:
  • binding : xyz.zedler.patrick.grocy.databinding.FragmentMealPlanPagingBinding (assigned in onCreateView)

Why this is dangerous:
- Fragment views are destroyed/recreated on config changes
- Retained View references prevent garbage collection
- Leaked Views hold references to Activity Context
- Can cause OutOfMemoryError with repeated Fragment transactions

Recommended Fix:
Override onDestroyView() and clear all View/Binding fields:
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    binding = null;
  }

🔴 StateHolderLeak

Static field holds UI/Context reference across configuration changes

Finding #29MasterProductCatBarcodesEditViewModel

Potential State Holder Memory Leak Detected
Class: xyz.zedler.patrick.grocy.viewmodel.MasterProductCatBarcodesEditViewModel
Issue: Scenario 1: ViewModel field 'args' of type 'xyz.zedler.patrick.grocy.fragment.MasterProductCatBarcodesEditFragmentArgs' holds UI reference. ViewModel survives config changes but UI is recreated.
Fix: Use LiveData or StateFlow instead of holding UI references.

Finding #30MasterProductCatConversionsViewModel

Potential State Holder Memory Leak Detected
Class: xyz.zedler.patrick.grocy.viewmodel.MasterProductCatConversionsViewModel
Issue: Scenario 1: ViewModel field 'args' of type 'xyz.zedler.patrick.grocy.fragment.MasterProductFragmentArgs' holds UI reference. ViewModel survives config changes but UI is recreated.
Fix: Use LiveData or StateFlow instead of holding UI references.

Finding #31TaskEntryEditViewModel

Potential State Holder Memory Leak Detected
Class: xyz.zedler.patrick.grocy.viewmodel.TaskEntryEditViewModel
Issue: Scenario 1: ViewModel field 'args' of type 'xyz.zedler.patrick.grocy.fragment.TaskEntryEditFragmentArgs' holds UI reference. ViewModel survives config changes but UI is recreated.
Fix: Use LiveData or StateFlow instead of holding UI references.

Finding #32RecipeEditIngredientListViewModel

Potential State Holder Memory Leak Detected
Class: xyz.zedler.patrick.grocy.viewmodel.RecipeEditIngredientListViewModel
Issue: Scenario 1: ViewModel field 'args' of type 'xyz.zedler.patrick.grocy.fragment.RecipeEditIngredientListFragmentArgs' holds UI reference. ViewModel survives config changes but UI is recreated.
Fix: Use LiveData or StateFlow instead of holding UI references.

Finding #33RecipeViewModel

Potential State Holder Memory Leak Detected
Class: xyz.zedler.patrick.grocy.viewmodel.RecipeViewModel
Issue: Scenario 1: ViewModel field 'args' of type 'xyz.zedler.patrick.grocy.fragment.RecipeFragmentArgs' holds UI reference. ViewModel survives config changes but UI is recreated.
Fix: Use LiveData or StateFlow instead of holding UI references.

Finding #34MasterProductViewModel

Potential State Holder Memory Leak Detected
Class: xyz.zedler.patrick.grocy.viewmodel.MasterProductViewModel
Issue: Scenario 1: ViewModel field 'args' of type 'xyz.zedler.patrick.grocy.fragment.MasterProductFragmentArgs' holds UI reference. ViewModel survives config changes but UI is recreated.
Fix: Use LiveData or StateFlow instead of holding UI references.

Finding #35MasterProductCatQuantityUnitViewModel

Potential State Holder Memory Leak Detected
Class: xyz.zedler.patrick.grocy.viewmodel.MasterProductCatQuantityUnitViewModel
Issue: Scenario 1: ViewModel field 'args' of type 'xyz.zedler.patrick.grocy.fragment.MasterProductCatQuantityUnitFragmentArgs' holds UI reference. ViewModel survives config changes but UI is recreated.
Fix: Use LiveData or StateFlow instead of holding UI references.

Finding #36RecipeEditViewModel

Potential State Holder Memory Leak Detected
Class: xyz.zedler.patrick.grocy.viewmodel.RecipeEditViewModel
Issue: Scenario 1: ViewModel field 'args' of type 'xyz.zedler.patrick.grocy.fragment.RecipeEditFragmentArgs' holds UI reference. ViewModel survives config changes but UI is recreated.
Fix: Use LiveData or StateFlow instead of holding UI references.

Finding #37MasterProductCatOptionalViewModel

Potential State Holder Memory Leak Detected
Class: xyz.zedler.patrick.grocy.viewmodel.MasterProductCatOptionalViewModel
Issue: Scenario 1: ViewModel field 'args' of type 'xyz.zedler.patrick.grocy.fragment.MasterProductCatOptionalFragmentArgs' holds UI reference. ViewModel survives config changes but UI is recreated.
Fix: Use LiveData or StateFlow instead of holding UI references.

Finding #38MasterProductCatAmountViewModel

Potential State Holder Memory Leak Detected
Class: xyz.zedler.patrick.grocy.viewmodel.MasterProductCatAmountViewModel
Issue: Scenario 1: ViewModel field 'args' of type 'xyz.zedler.patrick.grocy.fragment.MasterProductCatAmountFragmentArgs' holds UI reference. ViewModel survives config changes but UI is recreated.
Fix: Use LiveData or StateFlow instead of holding UI references.

Finding #39MasterProductCatLocationViewModel

Potential State Holder Memory Leak Detected
Class: xyz.zedler.patrick.grocy.viewmodel.MasterProductCatLocationViewModel
Issue: Scenario 1: ViewModel field 'args' of type 'xyz.zedler.patrick.grocy.fragment.MasterProductCatLocationFragmentArgs' holds UI reference. ViewModel survives config changes but UI is recreated.
Fix: Use LiveData or StateFlow instead of holding UI references.

Finding #40ShoppingListItemEditViewModel

Potential State Holder Memory Leak Detected
Class: xyz.zedler.patrick.grocy.viewmodel.ShoppingListItemEditViewModel
Issue: Scenario 1: ViewModel field 'args' of type 'xyz.zedler.patrick.grocy.fragment.ShoppingListItemEditFragmentArgs' holds UI reference. ViewModel survives config changes but UI is recreated.
Fix: Use LiveData or StateFlow instead of holding UI references.

Finding #41MasterProductCatConversionsEditViewModel

Potential State Holder Memory Leak Detected
Class: xyz.zedler.patrick.grocy.viewmodel.MasterProductCatConversionsEditViewModel
Issue: Scenario 1: ViewModel field 'args' of type 'xyz.zedler.patrick.grocy.fragment.MasterProductCatConversionsEditFragmentArgs' holds UI reference. ViewModel survives config changes but UI is recreated.
Fix: Use LiveData or StateFlow instead of holding UI references.

Finding #42MasterProductCatDueDateViewModel

Potential State Holder Memory Leak Detected
Class: xyz.zedler.patrick.grocy.viewmodel.MasterProductCatDueDateViewModel
Issue: Scenario 1: ViewModel field 'args' of type 'xyz.zedler.patrick.grocy.fragment.MasterProductCatDueDateFragmentArgs' holds UI reference. ViewModel survives config changes but UI is recreated.
Fix: Use LiveData or StateFlow instead of holding UI references.

Finding #43RecipeEditIngredientEditViewModel

Potential State Holder Memory Leak Detected
Class: xyz.zedler.patrick.grocy.viewmodel.RecipeEditIngredientEditViewModel
Issue: Scenario 1: ViewModel field 'args' of type 'xyz.zedler.patrick.grocy.fragment.RecipeEditIngredientEditFragmentArgs' holds UI reference. ViewModel survives config changes but UI is recreated.
Fix: Use LiveData or StateFlow instead of holding UI references.

Finding #44MasterProductCatBarcodesViewModel

Potential State Holder Memory Leak Detected
Class: xyz.zedler.patrick.grocy.viewmodel.MasterProductCatBarcodesViewModel
Issue: Scenario 1: ViewModel field 'args' of type 'xyz.zedler.patrick.grocy.fragment.MasterProductFragmentArgs' holds UI reference. ViewModel survives config changes but UI is recreated.
Fix: Use LiveData or StateFlow instead of holding UI references.

🔴 ThreadedUIReference

Worker thread captures Activity/Fragment/View reference

Finding #45LogFragment\n// (Full source code omitted for brevity)\n"

{
  "text_input": "package xyz.zedler.patrick.grocy.fragment;\n\n// Class: xyz.zedler.patrick.grocy.fragment.LogFragment\n// (Full source code omitted for brevity)\n",
  "output": "Yes",
  "project": "patrick",
  "explanation": "Scenario 1: Worker thread holds UI object reference\nClass: xyz.zedler.patrick.grocy.fragment.LogFragment\nMethod: void lambda$onViewCreated$2()\nStatement: $r1 \u003d new xyz.zedler.patrick.grocy.fragment.LogFragment$loadAsyncTask\nCaptured UI objects:\n  - r0 : xyz.zedler.patrick.grocy.fragment.LogFragment\nRisk: UI object will be kept in memory until thread completes\nFix: Use WeakReference or avoid passing UI objects to worker threads\n"
}
{
  "text_input": "package xyz.zedler.patrick.grocy.fragment;\n\n// Class: xyz.zedler.patrick.grocy.fragment.LogFragment\n// (Full source code omitted for brevity)\n",
  "output": "Yes",
  "project": "patrick",
  "explanation": "Scenario 1: Worker thread holds UI object reference\nClass: xyz.zedler.patrick.grocy.fragment.
… (truncated for brevity)

🔴 ViewModelContextReference

ViewModel stores Activity/Context reference causing memory leak

Finding #46BaseViewModel

ViewModel Memory Leak Risk:
Class: xyz.zedler.patrick.grocy.viewmodel.BaseViewModel
Violation: Field 'resources' of type android.content.res.Resources in ViewModel
Recommendation: Remove direct references to UI-related or context-holding classes
ViewModel Memory Leak Risk:
Method: <init>
Class: xyz.zedler.patrick.grocy.viewmodel.BaseViewModel
Violation: Local variable of type android.content.res.Resources assigned in ViewModel method
Line: -1
Recommendation: Avoid storing UI or context references
Code Snippet: r0.<xyz.zedler.patrick.grocy.viewmodel.BaseViewModel: android.content.res.Resources resources> = $r6
Suspicious ViewModel Context Retrieval:
Method: lambda$showSnackbarWithDetailsAction$3
Invoked Method: getContext
Invoked Class: android.view.View
Recommendation: Avoid retrieving context directly in ViewModel

How to respond to this issue:

  • If a finding is a true positive: consider applying the recommended fix and closing this issue.
  • If a finding is a false positive: please leave a comment explaining why — your feedback directly improves our research.
  • If you have questions: reply here or open a discussion.

This report was generated by LeakScope as part of the ICSE 2027 research artifact. Tool analyzes compiled APKs using Soot static analysis on grocy-android.

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