title: Memory Leak problem in custom view animation
body: <p><em>[Sorry For Bad English]</em><br>
  I'm trying to create a custom progress bar for my app<br>
  The memory is constantly filling up when the view is displayed<br>
  Is there a better solution to create it?<br></p>
  <pre><code>class Loading : View {
      constructor(context: Context?) : super(context)
      constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
      constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
          context,
          attrs,
          defStyleAttr
      )
  
      var angle = 0f
      val paint = Paint()
  
      init {
          val anim = ValueAnimator.ofFloat(0f, 360f)
          anim.apply {
              interpolator = LinearInterpolator()
              duration = 500
              repeatCount = ValueAnimator.INFINITE
          }
          anim.addUpdateListener {
              angle = it.animatedValue as Float
              invalidate()
          }
          anim.start()
  
  
          paint.apply {
              strokeWidth = 12f
              style = Paint.Style.STROKE
              color = Color.BLACK
              strokeCap = Paint.Cap.ROUND
          }
      }
  
      override fun draw(canvas: Canvas) {
          super.draw(canvas)
  
          canvas.drawArc(80f, 80f, 100f, 100f, angle, 40f, false, paint)
          canvas.drawArc(60f, 60f, 120f, 120f, angle, 60f, false, paint)
          canvas.drawArc(40f, 40f, 140f, 140f, angle, 80f, false, paint)
      }
  }
  </code></pre>
  <p>[Edit]</p>
  <p>It's all about graphics memory<br>
  It is filling up every second and it never stops</p>
  <p><a href="https://i.stack.imgur.com/lobgn.png" rel="nofollow noreferrer">Profiler1.PNG</a></p>
  <p><a href="https://i.stack.imgur.com/wP8aI.png" rel="nofollow noreferrer">Profiler2.PNG</a></p>