1

I have a NestedScrollView, it contains a RecyclerView wrap_content:

<android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

  LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
  layoutManager.setAutoMeasureEnabled(true);
  rvStream.setLayoutManager(layoutManager);
  rvStream.setNestedScrollingEnabled(false);

And when I use it to load list of images (using picasso), I got memory leak:

java.lang.OutOfMemoryError: Failed to allocate a 24 byte allocation with 0 free bytes and -3040B until OOM

How to avoid it, I'm also using lazy loading

Mihriban Minaz
  • 3,043
  • 2
  • 32
  • 52
Norutan
  • 1,480
  • 2
  • 14
  • 27
  • refer http://stackoverflow.com/a/37072179/6097062 – Saurabh Vardani May 19 '16 at 09:06
  • My guess is that putting a Recycler in a ScrollView will result in the Recycler "thinking" thank all of it is visible. It will therefore create adapter.getCount() of ViewHolders and call Picasso on each and every one of them. – Kelevandos May 19 '16 at 09:06
  • if you are working with images in a list or grid views.. then definitely you need to keep mobile compatible low resolution images. – GvSharma May 19 '16 at 10:30

0 Answers0