question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Images fail to render after several minutes of app use [Android, RN 0.24]

See original GitHub issue

Hi, 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:closed
  • Created 7 years ago
  • Reactions:9
  • Comments:45 (5 by maintainers)

github_iconTop GitHub Comments

9reactions
holyxiaoxincommented, May 31, 2016

It seems that the problem goes away after adding a key to the Image like:
<Image key={some-image-${index}}/>

5reactions
timsuchanekcommented, May 6, 2016

Same issue here. Even using RN 0.25.1 I tested it on 3 devices. With getImageCacheSize() 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:

Device Limit
One Plus 40659781
Samsung Galaxy S4 24892319
Nexus 5 22600605

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

toThinkOrNotToThink — React Native Images in Android
React Native Images in Android I've been lately working on a ... Images fail to render after several minutes of app use [Android,...
Read more >
Slow rendering - Android Developers
UI Rendering is the act of generating a frame from your app and displaying it on the screen. To ensure that a user's...
Read more >
Images fail to render in react-native when using resizeMode ...
Try to add android:largeHeap="true" in your android manifest application tag. Like the following stackoverflow-answer described.
Read more >
VMware Workspace ONE UEM™ Powered by AirWatch 2203 ...
Track and report app installation status on Windows devices with accuracy. Workspace ONE UEM console now allows you to see the accurate ...
Read more >
Images - React Native
Static Image Resources​ · Same system on Android and iOS. · Images live in the same folder as your JavaScript code. · No...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found