Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[LeakScope] 11 Android lifecycle/memory violations detected

Aperta
#3,188 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Tranquilla
Stack tecnologico
android, java
Ambito
mobile-dev

Direzione di ricerca

Inizia esaminando le classi e i metodi elencati, inclusi NotePreviewFragment, NoteEditFragment, AboutFragmentLicenseTab, BrandingUtil e le Activities interessate, per verificare ogni riferimento segnalato a Lifecycle, State-Holder e Worker-Thread. Il lavoro è completato quando tutti gli 11 Findings sono stati valutati e i leaks confermati sono stati risolti oppure i False Positives sono stati documentati in un commento dell’Issue; non sono indicati file sorgente o test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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 11 potential issue(s) across 3 detector type(s):

Severity Count
🔴 High 11
🟡 Medium 0
🟢 Low (improvement opportunity) 0
Detector Count Severity Description
FragmentViewFieldRetentionLeak 3 🔴 High Fragment stores View references in instance fields not cleared in onDestroyView()
StateHolderLeak 1 🔴 High Static field holds UI/Context reference across configuration changes
ThreadedUIReference 7 🔴 High Worker thread captures Activity/Fragment/View reference

Detailed Findings
🔴 FragmentViewFieldRetentionLeak

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

Finding #1 — NotePreviewFragment

Fragment View Field Retention Leak Detected
Class: it.niedermann.owncloud.notes.edit.NotePreviewFragment

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

- onDestroyView() is missing

Leaked Fields:
  • binding : it.niedermann.owncloud.notes.databinding.FragmentNotePreviewBinding (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 #2 — NoteEditFragment

Fragment View Field Retention Leak Detected
Class: it.niedermann.owncloud.notes.edit.NoteEditFragment

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

- onDestroyView() is missing

Leaked Fields:
  • binding : it.niedermann.owncloud.notes.databinding.FragmentNoteEditBinding (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 #3 — AboutFragmentLicenseTab

Fragment View Field Retention Leak Detected
Class: it.niedermann.owncloud.notes.about.AboutFragmentLicenseTab

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

- onDestroyView() is missing

Leaked Fields:
  • binding : it.niedermann.owncloud.notes.databinding.FragmentAboutLicenseTabBinding (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 #4 — BrandingUtil

Potential State Holder Memory Leak Detected
Class: it.niedermann.owncloud.notes.branding.BrandingUtil
Issue: Scenario 1: Long-lived class field 'dialog' of type 'com.nextcloud.android.common.ui.theme.utils.DialogViewThemeUtils' holds UI reference. Prevents UI garbage collection.
Fix: Avoid storing UI in long-lived components. Use WeakReference.
🔴 ThreadedUIReference

Worker thread captures Activity/Fragment/View reference

Finding #5 — ManageAccountsActivity

Scenario 1: Worker thread holds UI object reference
Class: it.niedermann.owncloud.notes.manageaccounts.ManageAccountsActivity
Method: void lambda$changeAccountSetting$6(it.niedermann.owncloud.notes.databinding.DialogEditSettingBinding,it.niedermann.owncloud.notes.persistence.NotesRepository,it.niedermann.owncloud.notes.persistence.entity.Account,java.util.function.Function,int,java.util.function.Function,android.content.DialogInterface,int)
Statement: $r7 = new it.niedermann.owncloud.notes.manageaccounts.ManageAccountsActivity$$ExternalSyntheticLambda3
Captured UI objects:
  - r0 : it.niedermann.owncloud.notes.manageaccounts.ManageAccountsActivity
Risk: UI object will be kept in memory until thread completes
Fix: Use WeakReference or avoid passing UI objects to worker threads

Finding #6 — NotePreviewFragment\n// (Full source code omitted for brevity)\n"

{
  "text_input": "package it.niedermann.owncloud.notes.edit;\n\n// Class: it.niedermann.owncloud.notes.edit.NotePreviewFragment\n// (Full source code omitted for brevity)\n",
  "output": "Yes",
  "project": "owncloud",
  "explanation": "Scenario 1: Worker thread holds UI object reference\nClass: it.niedermann.owncloud.notes.edit.NotePreviewFragment\nMethod: void lambda$onRefresh$6()\nStatement: $r4 \u003d new it.niedermann.owncloud.notes.edit.NotePreviewFragment$$ExternalSyntheticLambda4\nCaptured UI objects:\n  - r0 : it.niedermann.owncloud.notes.edit.NotePreviewFragment\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 it.niedermann.owncloud.notes.edit;\n\n// Class: it.niedermann.owncloud.notes.edit.NotePreviewFragment\n// (Full source code omitted for brevity)\n",
  "output": "Yes",
  "project": "owncloud",
  "explanation": "Scenario 1: Worker thread holds UI object re
… (truncated for brevity)

Finding #7 — BaseNoteFragment\n// (Full source code omitted for brevity)\n"

{
  "text_input": "package it.niedermann.owncloud.notes.edit;\n\n// Class: it.niedermann.owncloud.notes.edit.BaseNoteFragment\n// (Full source code omitted for brevity)\n",
  "output": "Yes",
  "project": "owncloud",
  "explanation": "Scenario 1: Worker thread holds UI object reference\nClass: it.niedermann.owncloud.notes.edit.BaseNoteFragment\nMethod: boolean onOptionsItemSelected(android.view.MenuItem)\nStatement: $r22 \u003d new it.niedermann.owncloud.notes.edit.BaseNoteFragment$$ExternalSyntheticLambda4\nCaptured UI objects:\n  - r0 : it.niedermann.owncloud.notes.edit.BaseNoteFragment\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 it.niedermann.owncloud.notes.edit;\n\n// Class: it.niedermann.owncloud.notes.edit.BaseNoteFragment\n// (Full source code omitted for brevity)\n",
  "output": "Yes",
  "project": "owncloud",
  "explanation": "Scenario 1: Worker thread holds
… (truncated for brevity)

Finding #8 — MainActivity\n// (Full source code omitted for brevity)\n"

{
  "text_input": "package it.niedermann.owncloud.notes.main;\n\n// Class: it.niedermann.owncloud.notes.main.MainActivity\n// (Full source code omitted for brevity)\n",
  "output": "Yes",
  "project": "owncloud",
  "explanation": "Scenario 1: Worker thread holds UI object reference\nClass: it.niedermann.owncloud.notes.main.MainActivity\nMethod: void lambda$onActivityResult$38(com.nextcloud.android.sso.model.SingleSignOnAccount)\nStatement: $r2 \u003d new it.niedermann.owncloud.notes.main.MainActivity$$ExternalSyntheticLambda17\nCaptured UI objects:\n  - r0 : it.niedermann.owncloud.notes.main.MainActivity\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 it.niedermann.owncloud.notes.main;\n\n// Class: it.niedermann.owncloud.notes.main.MainActivity\n// (Full source code omitted for brevity)\n",
  "output": "Yes",
  "project": "owncloud",
  "explanation": "Scenario 1: Worker 
… (truncated for brevity)

Finding #9 — NoteListWidgetConfigurationActivity

Scenario 1: Worker thread holds UI object reference
Class: it.niedermann.owncloud.notes.widget.notelist.NoteListWidgetConfigurationActivity
Method: void onCreate(android.os.Bundle)
Statement: $r16 = new it.niedermann.owncloud.notes.widget.notelist.NoteListWidgetConfigurationActivity$$ExternalSyntheticLambda1
Captured UI objects:
  - r0 : it.niedermann.owncloud.notes.widget.notelist.NoteListWidgetConfigurationActivity
Risk: UI object will be kept in memory until thread completes
Fix: Use WeakReference or avoid passing UI objects to worker threads

Finding #10 — SingleNoteWidgetConfigurationActivity

Scenario 1: Worker thread holds UI object reference
Class: it.niedermann.owncloud.notes.widget.singlenote.SingleNoteWidgetConfigurationActivity
Method: void onNoteClick(int,android.view.View)
Statement: $r2 = new it.niedermann.owncloud.notes.widget.singlenote.SingleNoteWidgetConfigurationActivity$$ExternalSyntheticLambda1
Captured UI objects:
  - r0 : it.niedermann.owncloud.notes.widget.singlenote.SingleNoteWidgetConfigurationActivity
Risk: UI object will be kept in memory until thread completes
Fix: Use WeakReference or avoid passing UI objects to worker threads

Finding #11 — ImportAccountActivity

Scenario 1: Worker thread holds UI object reference
Class: it.niedermann.owncloud.notes.importaccount.ImportAccountActivity
Method: void lambda$onActivityResult$6(com.nextcloud.android.sso.model.SingleSignOnAccount)
Statement: $r8 = new it.niedermann.owncloud.notes.importaccount.ImportAccountActivity$$ExternalSyntheticLambda5
Captured UI objects:
  - r0 : it.niedermann.owncloud.notes.importaccount.ImportAccountActivity
Risk: UI object will be kept in memory until thread completes
Fix: Use WeakReference or avoid passing UI objects to worker threads

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 notes-android.

Lingua principale
Java
Stelle
1.1k
Fork
168
Merge medio
21h 49m
PR unite (30g)
29

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nextcloud/notes-android

Tutte le issue di nextcloud/notes-android

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.