0

When rotating the emulator the memory leak below pops up. I'm not able to figure out exactly where it comes from. To me it looks like the systems AutofillClientController is leaking my ExampleActivity. Any thoughts are appreciated!

Tested on:

  • Pixel 7 Pro API 34
  • Pixel 4 API 31
  • Pixel 3a API 28
  • Pixel 4 API 21 (report is slightly different, but I think the cause is the same)
  • LeakCanary 2.13
┬───
│ GC Root: System class
│
├─ android.provider.FontsContract class
│ Leaking: NO (ExampleApplication↓ is not leaking and a class is
│ never leaking)
│ ↓ static FontsContract.sContext
├─ com.example.ExampleApplication instance
│ Leaking: NO (Application is a singleton)
│ mBase instance of android.app.ContextImpl
│ ↓ Application.mLoadedApk
│ ~~~~~~~~~~
├─ android.app.LoadedApk instance
│ Leaking: UNKNOWN
│ Retaining 206.8 kB in 4052 objects
│ mApplication instance of com.example.
│ ExampleApplication
│ Receivers
│ ..ExampleApplication@321728936
│ ....VisibilityTracker@329242680
│ ....aF@329242760
│ ....d@329242824
│ ....RF@329242896
│ ....ProxyChangeListener$ProxyReceiver@329242968
│ ↓ LoadedApk.mServices
│ ~~~~~~~~~
├─ android.util.ArrayMap instance
│ Leaking: UNKNOWN
│ Retaining 203.2 kB in 4011 objects
│ ↓ ArrayMap.mArray
│ ~~~~~~
├─ java.lang.Object[] array
│ Leaking: UNKNOWN
│ Retaining 203.2 kB in 4009 objects
│ ↓ Object[2]
│ ~~~
├─ android.app.ContextImpl instance
│ Leaking: UNKNOWN
│ Retaining 6.2 kB in 86 objects
│ mOuterContext instance of android.app.ContextImpl
│ ContextImpl.mOuterContext == ContextImpl.this: not tied to any particular
│ lifecycle
│ ↓ ContextImpl.mAutofillClient
│ ~~~~~~~~~~~~~~~
├─ android.view.autofill.AutofillClientController instance
│ Leaking: UNKNOWN
│ Retaining 26 B in 1 objects
│ mActivity instance of com.example.ui.ExampleActivity
│ with mDestroyed = true
│ ↓ AutofillClientController.mActivity
│ ~~~~~~~~~
╰→ com.example.ui.ExampleActivity instance
​ Leaking: YES (ObjectWatcher was watching this because com.example.ui.ExampleActivity received Activity#onDestroy() callback
​ and Activity#mDestroyed is true)
​ Retaining 51.8 kB in 1004 objects
​ key = a1f4ff6a-48ea-4ba9-90c4-7f746b99af89
​ watchDurationMillis = 7757
​ retainedDurationMillis = 2755
​ mApplication instance of com.example.ExampleApplication
​ mBase instance of androidx.appcompat.view.ContextThemeWrapper
METADATA
Build.VERSION.SDK_INT: 34
Build.MANUFACTURER: Google
LeakCanary version: 2.13
App process name: com.example
Class count: 35752
Instance count: 351728
Primitive array count: 189083
Object array count: 44181
Thread count: 64
Heap total bytes: 39264516
Bitmap count: 35
Bitmap total bytes: 2247331
Large bitmap count: 0
Large bitmap total bytes: 0
Stats: LruCache[maxSize=3000,hits=166095,misses=321890,hitRate=34%]
RandomAccess[bytes=15827352,reads=321890,travel=107139495512,range=47678011,size
=58241724]
Analysis duration: 26210 ms
asked Apr 16, 2024 at 13:31
2
  • 1
    Agreed, that feels like a leak caused by the framework. Commented Apr 16, 2024 at 13:39
  • it would be helpful if you can share the activity code please Commented Apr 16, 2024 at 14:32

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.