Images fail to render after several minutes of app use [Android, RN 0.24]
See original GitHub issueHi, I am in the process of building an app that relies on a relatively large amount of network-based images, loaded with the source={{uri: uri}}
prop. This works well for a while, but after several minutes of using the app, it seems to have run out of memory for these images. At that point, instead of rendering, new images will either remain blank, or render a black box. The app also starts slowing down and becoming jittery. I have tried to debug with systrace, but I can’t for the life of me get the newest version to show traces in any browser,
Since my app is image heavy, I have added the largeHeap directive to my manifest, which helped, but I know that there is a better solution. I also am making sure to request smaller-dimensioned versions of the images. Does anyone have experience freeing memory from network images? This is fairly urgent, and any advice would be most appreciated.
Sam
Issue Analytics
- State:
- Created 7 years ago
- Reactions:9
- Comments:45 (5 by maintainers)
It seems that the problem goes away after adding a key to the Image like:
<Image key={
some-image-${index}}/>
Same issue here. Even using
RN 0.25.1
I tested it on 3 devices. WithgetImageCacheSize()
from react-native-http-cache I logged the image cache size every second. After a while the cache stops growing. On each device it stops at different cache sizes:Now I just bruteforce called
clearImageCache()
every 10 sec. Didn’t solve the problem. Still after loading many pictures (maybe around 100 - 150), it stops.So it’s probably not related to the image cache, what was my first assumption. So the problem probably lies in fresco / the bindings to fresco.
New
<Image>
elements just stay white. No error.@foghina You implemented some of the RN Android fresco stuff. Have any idea what could cause the problem?
Thanks in advance!