I make a media player for Android TV boxes, phones and Windows. People sign in with the playlist their provider gives them, and the app downloads three lists from the provider's server: live channels, films and series. Each one is a single JSON array.
On paper that is easy: await (await fetch(url)).json() . In practice it broke on real hardware, and the fix taught me more about memory on cheap devices than anything else this year.
How big these lists really are
These are measured numbers from real accounts, not guesses:
one list alone: 72 MB of JSON
the three lists of one account together: 156 MB
another account: 28,445 channels, 157,163 films and 50,149 series, 131 MB in total
Reading one of those whole needs several times its size in memory at the same moment: the raw bytes, the string made from them, and every object JSON.parse builds. On an Android TV box with 4 GB of RAM the download simply failed.…