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
Solved this by using
windowSize
andremovedClippedSubviews
props fromFlatList
. I setwindowSize
to 5 for android devices.Add option
android:largeHeap="true"
in<application>
tag ofandroid/app/src/main/AndroidManifest.xml
file to fix your error: