TL;DR Avoid doing this: new HashMap<String, String>() {{ put("key", value); }}; Leak Trace I was recently looking at the following leak trace from LeakCanary: ┬─── │ GC Root: Global variable in native code │ ├─ com.bugsnag.android.AnrPlugin instan...

Markdown supported · ⌘↵ to post
Svyatoslav Starkov
To avoid leaks one can wrap double brace initialization into a static function. Not pretty, but should work.