Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

[LeakScope] 11 Android lifecycle/memory violations detected

Abierto
#3,188 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Tranquilo
Stack tecnológico
android, java
Área
mobile-dev

Línea de trabajo

Comienza revisando las clases y métodos enumerados, incluidos NotePreviewFragment, NoteEditFragment, AboutFragmentLicenseTab, BrandingUtil y las Activities afectadas, para verificar cada referencia reportada a Lifecycle, State-Holder y Worker-Thread. Se considerará completado cuando se hayan evaluado los 11 Findings y se hayan corregido los leaks confirmados o documentado los False Positives en un comentario del Issue; no se indican archivos fuente ni tests.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Java
Estrellas
1.1k
Forks
168
Merge medio
21 h 49 min
PR fusionados (30 d)
29

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de nextcloud/notes-android

Todos los issues de nextcloud/notes-android

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.