mixpanel / mixpanel-react-native

Official React Native Tracking Library for Mixpanel Analytics
https://mixpanel.com
Apache License 2.0
105 stars 44 forks source link

Does Mixpanel also cache data in RAM until flush? #217

Closed sbrighiu closed 6 months ago

sbrighiu commented 9 months ago

We have an app that uses background audio and Mixpanel. We update the user progress from time to time in the app and for a small userbase we are experiencing OOM crashes, and they seem to happen in both background and foreground.

Is it possible that the Mixpanel SDK is caching too much data in RAM while it is saving and holding events to be flushed, and if so, is there a way for me to test if it is to blame for the crashes?

zihejia commented 6 months ago

hi @sbrighiu , sorry for the late response, you can set a smaller batch size to reduce the memory footprint. The "Flush Batch Size" represents the number of events sent in a single network request to the Mixpanel server. While the default value is 50, you can reduce it to 10 by using setFlushBatchSize(10). I'm closing this one, feel free to reopen if the problem still exists.