iOS hangs when selecting many photos for EXIF scanning #1

Closed
opened 2026-05-25 20:19:56 +00:00 by shawn · 0 comments
Owner

Bug

Selecting 50+ photos from iOS Photos app causes the tab to hang/freeze completely.

Root Cause

FileReader.readAsDataURL() in scanPhoto() reads the entire file into memory as a base64 string. A typical iPhone photo is 3-12 MB, producing ~7 MB data URLs. With 50 photos that is 350+ MB of strings in memory — exceeding iOS Safari per-tab memory limit.

Fix

  1. Replaced readAsDataURL with URL.createObjectURL(file) — zero-copy, no memory bloat.
  2. Reduced batch size from 4 to 2 — fewer concurrent file reads.
  3. Added URL.revokeObjectURL() on reset — prevents blob URL leaks.

Files changed

  • static/index.html: scanPhoto, batch size, resetAll cleanup
  • server.py: HEIC/HEIF support (unrelated, included in commit)
## Bug Selecting 50+ photos from iOS Photos app causes the tab to hang/freeze completely. ## Root Cause `FileReader.readAsDataURL()` in `scanPhoto()` reads the entire file into memory as a base64 string. A typical iPhone photo is 3-12 MB, producing ~7 MB data URLs. With 50 photos that is 350+ MB of strings in memory — exceeding iOS Safari per-tab memory limit. ## Fix 1. Replaced `readAsDataURL` with `URL.createObjectURL(file)` — zero-copy, no memory bloat. 2. Reduced batch size from 4 to 2 — fewer concurrent file reads. 3. Added `URL.revokeObjectURL()` on reset — prevents blob URL leaks. ## Files changed - `static/index.html`: scanPhoto, batch size, resetAll cleanup - `server.py`: HEIC/HEIF support (unrelated, included in commit)
shawn closed this issue 2026-05-25 20:20:07 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shawn/exif-test#1