skip to Main Content

I have 25-30 items in my FlatLis but I don’t render all of them initially, I am fetching more and more when user reaches the end. After 24-25 images, I am getting this error on some particular android devices and emulators:

 Pool hard cap violation? Hard cap = 150994944 Used size = 150539928 Free size = 0 Request size = 1680000

This error coming from Image’s onError prop.

the invidiual item looks like this;

   <Image
                ref={imageRef}
                onError={async (e) => {
                    console.log('IMAGE LOAD error', e.nativeEvent.error);
                }}
                {...props}
                source={source}
                onLoadEnd={onLoadEnd}
                resizeMode="cover"
            />

Each image is around 200kb so the size shouldn’t be a problem I suppose.

2

Answers


  1. Chosen as BEST ANSWER

    Solved this by using windowSize and removedClippedSubviews props from FlatList. I set windowSize to 5 for android devices.


  2. Add option android:largeHeap="true" in <application> tag of android/app/src/main/AndroidManifest.xml file to fix your error:

    <application
      android:largeHeap="true"
      ...
    >
      ...
    </application>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search