-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OutOfMemoryError on android #649
Comments
I too am getting a lot of these errors and crashes, and only on Android:
|
Hmm, how come it wants to allocate almost 70 megs? What size are you rendering at? I suspect that its bigger than the actual screen, which is redundant, as it shouldn't improve quality noticeably but will require a lot of extra work and resources. |
I'm rendering 3 activity rings, taking up a max of 50% of the screen, using react-native-circular-progress. In our case, I think the inefficiency may be via the transitive dependency of ART, and our team was going to re-write using just I'll switch to that and report back here whether our insane memory allocation persists. @awchang56 ^^ |
I'm seeing the same stack trace on Android, commenting here to follow the thread. It happens after numerous reloads while connected to my debugger. Maybe it's not reallocating memory for SVGs on reload, it may behave differently with a release APK. Haven't investigated it too much yet |
I use react-native-shadow to render shadow in a long list, and I get errors like this. |
Perhaps try setting it around the list instead of the elements, or render it somehow that you only have one instance (at most screen size) of it instead of several / a big one. |
Same problem here, I have a list of SVG elements (a chart), and memory usage shoots up when the list gets rendered - and the memory is never released, even after the chart component is unmounted, which is the actual problem for me. I've tried an example without any event listeners or closures, so those can't be the reason for the memory being retained. The minimal example is a |
Upgrading from 7.0.2 to 7.1.2 (somewhat) solved this for me. Memory is now released, although not predictably, nor completely. Navigating away from the SVG list component, memory is kept, but when mounting it again, memory goes back down to what it was the first time the chart was mounted. So at least it's not accumulating and I can't produce OOM errors anymore. |
@jfr3000 Good to hear upgrading helped. If you can make a small replication that would be very much appreciated! I've also made quite a significant refactor of the android implementation in the plain-views branch, I wonder if those would affect the situation. Would you mind testing? |
I'm experiencing the same issue. I am on version ^7.0.2. is that the latest version or is it possible to upgrade to 7.1.2? Didn't find that version under releases |
Yeah, 7.2.0 is the latest: https://www.npmjs.com/package/react-native-svg?activeTab=versions |
v8 has been released now as well |
Closing this as the cause is most likely svg elements which are much bigger than the screen. |
#518
The text was updated successfully, but these errors were encountered: