I'm encountering crashes in my React Native iOS app (running on an iPhone 13 with iOS 17) when serving large data packets via SSE using the 'event-source-polyfill'. The crashes coincide with sudden spikes in RAM consumption, as monitored using React Native's perf monitor. With multiple stream hits, the app exhibits incremental memory consumption before eventually crashing. The error message I've found in the code is 'com.facebook.react.JavaScript (14): EXC_RESOURCE (RESOURCE_TYPE_MEMORY: high watermark memory limit exceeded) (limit=2098 MB)'. How can I optimize memory usage and address these crashes?
I'm encountering crashes in my React Native iOS app (running on an iPhone 13 with iOS 17) when serving large data packets via SSE using the 'event-source-polyfill'. The crashes coincide with sudden spikes in RAM consumption, as monitored using React Native's perf monitor. With multiple stream hits, the app exhibits incremental memory consumption before eventually crashing. The error message I've found in the code is 'com.facebook.react.JavaScript (14): EXC_RESOURCE (RESOURCE_TYPE_MEMORY: high watermark memory limit exceeded) (limit=2098 MB)'. How can I optimize memory usage and address these crashes?