Skip to content

Add memory leak detection with LeakCanary #99

@callebtc

Description

@callebtc

Description:
The app has potential memory leaks (Handler cleanup, resource management) but lacks automated detection during development.

Benefits of LeakCanary:

  1. Automatic memory leak detection
  2. Detailed leak traces and analysis
  3. Helps identify Handler, Activity, and resource leaks
  4. Essential for POS apps that run continuously

Fix Instructions:

  1. Add LeakCanary dependency to build.gradle:
dependencies {
    // Debug builds only
    debugImplementation "com.squareup.leakcanary:leakcanary-android:2.12"
}
  1. LeakCanary automatically initializes, no code changes needed

  2. Test scenarios prone to leaks:

    • Rapidly opening/closing activities
    • NFC operations with card tap/remove cycles
    • Network operations during app backgrounding
    • Handler-based operations

Testing Priority:

  1. ModernPOSActivity (main POS interface)
  2. PaymentRequestActivity (payment flows)
  3. BalanceCheckActivity (NFC operations)
  4. Activities with Handler usage

Implementation:

  • Debug builds only (no impact on release)
  • Provides heap dump analysis
  • Shows leak traces in notifications

Priority: High - critical for identifying existing memory leaks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions