Browser troubleshooting
Why reading a JSON file can create several copies
A JSON import can retain file bytes, a decoded text string, a parsed object graph, and derived arrays at the same time. A file that fits on disk may still exceed a tab’s practical memory budget during processing.
Worked example
Worked reference example
Input bytes → decoded text → parsed records → normalized records → rendered rows
Possible improvements:
- Reject unexpectedly large inputs before reading.
- Avoid keeping both original and normalized copies unnecessarily.
- Render a limited view rather than every record at once.
- Choose a streaming format when the source permits it.How it works
Each transformation can allocate data beyond the source file’s byte size. Rendering thousands of rows adds DOM and layout costs. Identifying the stage that grows is more actionable than raising a guessed browser memory limit.
Limits and mistakes
Ordinary JSON.parse requires a complete JSON text value and does not become streaming simply because the file was read in chunks. A worker can improve responsiveness while total memory use remains high or increases through copies.
Check the result
Test increasing synthetic fixture sizes and record which stage fails or stalls. Keep counts and timings per stage without logging private file contents.
Sources
Reference documentation for the behavior used in this guide: