<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Curry Restaurant</title><link>https://blog.galiren.me/</link><description>Recent content on Curry Restaurant</description><generator>Hugo</generator><language>en</language><lastBuildDate>Tue, 28 Jul 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://blog.galiren.me/index.xml" rel="self" type="application/rss+xml"/><item><title>Diving into LeakCanary</title><link>https://blog.galiren.me/posts/dive-into-leakcanary/</link><pubDate>Tue, 28 Jul 2026 00:00:00 +0000</pubDate><guid>https://blog.galiren.me/posts/dive-into-leakcanary/</guid><description>&lt;p>&lt;a href="https://square.github.io/leakcanary/">LeakCanary&lt;/a> is a widely used library for detecting memory leaks in Android apps.&lt;/p>
&lt;p>Adding a dependency is enough to get it running.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-kotlin" data-lang="kotlin">&lt;span class="line">&lt;span class="cl">&lt;span class="n">dependencies&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="c1">// debugImplementation because LeakCanary should only run in debug builds.
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1">&lt;/span> &lt;span class="n">debugImplementation&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="s2">&amp;#34;com.squareup.leakcanary:leakcanary-android:2.14&amp;#34;&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Install a debug build on a device and a canary launcher appears next to the app. When a leak is found, LeakCanary reports it with a toast or a notification.&lt;/p>
&lt;p>&lt;img src="https://square.github.io/leakcanary/images/dumping-toast.png" alt="LeakCanary dumping toast" loading="lazy" decoding="async">
&lt;/p>
&lt;p>This article is about why that works without any initialization code in the application.&lt;/p></description></item></channel></rss>