title: Memory leak caused by img.setBackgroundResource
body: <p><br />
  I have an animation I want to run, and when I set the drawable for it, there is a memory leak. I dont know if it matters, but the frames are only in the drawable folder and not in specific dpi folders. The memory leak happens even before I start the animation. It happens when I set the resource of the animation.
  Thanks!</p>
  
  <p>The call:</p>
  
  <pre><code>logoAnimation.setBackgroundResource(R.drawable.logo_animation);
  </code></pre>
  
  <p>logo_animation.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;animation-list xmlns:android="http://schemas.android.com/apk/res/android"
  android:oneshot="false"&gt;
  
      &lt;item android:drawable="@drawable/logo0" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo1" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo2" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo3" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo4" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo5" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo6" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo7" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo8" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo9" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo10" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo11" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo12" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo13" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo14" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo15" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo16" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo17" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo18" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo19" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo20" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo21" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo22" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo23" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo24" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo25" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo26" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo27" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo28" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo29" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo30" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo31" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo32" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo33" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo34" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo35" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo36" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo37" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo38" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo39" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo40" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo41" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo42" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo43" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo44" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo45" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo46" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo47" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo48" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo49" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo50" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo51" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo52" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo53" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo54" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo55" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo56" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo57" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo58" android:duration="35" /&gt;
      &lt;item android:drawable="@drawable/logo59" android:duration="35" /&gt;
  
  &lt;/animation-list&gt;
  </code></pre>
  
  <p>Logcat output:</p>
  
  <pre><code>08-08 12:42:10.710: D/dalvikvm(6122): GC_CONCURRENT freed &lt;1K, 3% free 10269K/10567K, paused 2ms+1ms
  08-08 12:42:13.135: D/dalvikvm(6122): GC_FOR_ALLOC freed 115K, 3% free 10490K/10759K, paused 10ms
  08-08 12:42:13.160: D/dalvikvm(6122): GC_FOR_ALLOC freed 130K, 4% free 10781K/11143K, paused 9ms
  08-08 12:42:13.215: D/dalvikvm(6122): GC_FOR_ALLOC freed 195K, 4% free 11155K/11527K, paused 25ms
  08-08 12:42:13.265: D/dalvikvm(6122): GC_FOR_ALLOC freed 130K, 4% free 11512K/11911K, paused 20ms
  08-08 12:42:13.295: D/dalvikvm(6122): GC_FOR_ALLOC freed 195K, 4% free 11951K/12423K, paused 10ms
  08-08 12:42:13.325: D/dalvikvm(6122): GC_FOR_ALLOC freed 260K, 4% free 12535K/12999K, paused 9ms
  08-08 12:42:13.360: D/dalvikvm(6122): GC_FOR_ALLOC freed 325K, 4% free 13266K/13767K, paused 9ms
  08-08 12:42:13.400: D/dalvikvm(6122): GC_FOR_ALLOC freed 391K, 4% free 14143K/14727K, paused 9ms
  08-08 12:42:13.450: D/dalvikvm(6122): GC_FOR_ALLOC freed 521K, 5% free 15313K/16071K, paused 10ms
  08-08 12:42:13.510: D/dalvikvm(6122): GC_FOR_ALLOC freed 587K, 5% free 16628K/17415K, paused 10ms
  08-08 12:42:13.570: D/dalvikvm(6122): GC_FOR_ALLOC freed 587K, 5% free 17942K/18759K, paused 10ms
  </code></pre>