Earlier quoted context omitted.
I analysed react-native's performance issues with images and out-of-memory-errors a while back. Their (and their image library Fresco's) problem is that they make heavy use of object-finalizers, which is an error in Java and especially Android. I reported a couple of bugs, but got dismissed: https://github.com/facebook/react-native/issues/8711 https://github.com/facebook/react-native/issues/8780 https://github.com/fa…
Hey, RN Android dev here: re: object finalizers: - For Fresco, I think Balazs provided a pretty good response here on how Fresco uses the finalizers ( https://github.com/facebook/react-native/issues/8711#issueco... ). If you still think there's an issue here, I'll direct Balazs to this post. - For RN, I remember the issue you cited stated that using Object.finalize is 430x slower than having no finalizer, which sound…
I want to stress again that finalizers complicate and slows code in very complex ways. Just measuring the startup time isn't enough. You essentially slow down the garbage collector by giving him work and code he can't analyse or optimise.
The mere usage of finalizers, even if they log only, can lead to Out-Of-Memory-errors when there's still memory available!
This user showed that the numbers of waiting finalizers went up to a couple of thousand after they switching to Fresco: https://github.com/facebook/fresco/issues/1363#issuecomment-...
Think about it: 5000 finalizers waiting to be run! The finalizer-queue is single-threaded, which means that every other object on the same ART that has a finalizer will have to wait until these 5000 finalizers are through, before they can be garbage collected.
No need to apologize though, I know that RN is being flooded with attention and changing core code is not trivial.
Again, thank you for your time.