mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
The shared backup reader kept documents without their stored bytes but kept every ECG strip whole, trace included. A long watch history is hundreds of strips of tens to hundreds of kilobytes each, so an upload, preview or restore of such a copy held the whole history in memory. The first read now keeps each strip without its trace (a short stand-in, after the key it was written under is recorded and its form checked), and forEachEcgTrace reads the traces again one strip at a time. The ECG restore writes each strip from that second read, as the document restore already did, and refuses a file whose two reads disagree on the count. The upload memory test gains an ECG-heavy file: 150 strips, about 200 MB. The old reader held 197 MB of it and failed the 48 MB bound; the new one holds about 1 MB, also under a 524 MB heap.