title: Volley request inside recyclerview adapter
body: <p>I am using Volley image request inside recyclerview adapter.
  Request appears to work fine until a fast scroll is done, whenever I scroll the recyclerview fast up or down, the app crashes with following error :</p>
  
  <pre><code> java.lang.OutOfMemoryError: Could not allocate JNI Env: Failed anonymous mmap(0x0, 8192, 0x3, 0x22, -1, 0): Permission denied. See process maps in the log.
      at java.lang.Thread.nativeCreate(Native Method)
      at java.lang.Thread.start(Thread.java:883)
      at com.android.volley.RequestQueue.start(RequestQueue.java:134)
      at com.android.volley.toolbox.Volley.newRequestQueue(Volley.java:91)
      at com.android.volley.toolbox.Volley.newRequestQueue(Volley.java:67)
      at com.android.volley.toolbox.Volley.newRequestQueue(Volley.java:102)
      at com.squadtechs.hdwallpapercollection.main_activity.fragment.WallpaperAdapter.populateViews(WallpaperAdapter.kt:60)
      at com.squadtechs.hdwallpapercollection.main_activity.fragment.WallpaperAdapter.onBindViewHolder(WallpaperAdapter.kt:38)
      at com.squadtechs.hdwallpapercollection.main_activity.fragment.WallpaperAdapter.onBindViewHolder(WallpaperAdapter.kt:21)
  </code></pre>
  
  <p>Following is my <code>onBindViewHolder()</code> code:</p>
  
  <pre><code>   override fun onBindViewHolder(holder: WallpaperHolder, position: Int) {
      populateViews(holder, position)
  }
  
  private fun populateViews(holder: WallpaperHolder, position: Int) {
      val requestQueue = Volley.newRequestQueue(context)
      val imageRequest = ImageRequest(
          list[position].wallpaper_image_url,
          Response.Listener { response -&gt;
              holder.imgGrid.scaleType = ImageView.ScaleType.CENTER
              holder.imgGrid.setImageBitmap(response)
              holder.progress.visibility = View.GONE
          },
          1024,
          860,
          ImageView.ScaleType.CENTER,
          null,
          Response.ErrorListener { error -&gt;
              Toast.makeText(context, "Error loading Image", Toast.LENGTH_LONG).show()
              holder.progress.visibility = View.GONE
          }).setRetryPolicy(
          DefaultRetryPolicy(
              20000,
              DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
              DefaultRetryPolicy.DEFAULT_BACKOFF_MULT
          )
      )
      requestQueue.add(imageRequest)
      holder.txtCategory.visibility = View.GONE
  }
  </code></pre>
  
  <p>According to log, error is thrown at line where request queue is declared, i.e <code>val requestQueue = Volley.newRequestQueue(context)</code></p>
  
  <p><strong>Remember: the app works fine when scroled normally but crashes when scrolled fast</strong></p>