Description
[REQUIRED] Describe your environment
- Operating System version: iPhone iOS 15.4
- Browser version: Safari 15
- Firebase SDK version: 9.6.10
- Firebase Product: Firestore
[REQUIRED] Describe the problem
We found that Firebase is keep crashing on mobile Safari because of out of memory. It seems that firebase is using much much more memory than expected.
We've created a minimal replication of this problem.
Source code: https://github.com/team-reflect/firebase-memory-issue
Online demo: https://firebase-memory-issue-2022-04.vercel.app/
In this replication, each document contains about 39KB of data (with a string length of about 39000). On my iPhone Xr (with 3GB of memory), this webpage will crash after loading about 750 documents, which is about 30MB of raw data in total. The browser memory usage is about 1.6GB right before the crashing.
Steps to reproduce:
Open the link above with iOS Safari. Click the click me to load 2000 documents
button. Wait for the browser to load data and crash.
Connect the iPhone with a Mac then you can see the memory usage of the mobile Safari. You can see the memory usage of my iPhone Safari in the repo link above.
Relevant Code:
Check the source code link above.