Stream crash dumps into diagnostic reports to reduce launcher memory use #438

Open
HandshakeHackin wants to merge 2 commits from upstream-pr/438 into v26123
HandshakeHackin commented 2026-12-01 16:08:42 +00:00 (Migrated from github.com)

Imported from PastiiJay/klbf-lab. Originally posted by HandshakeHackin on 2026-12-01T16:08:42Z.


The tester in #437 observed 5 GB of launcher memory after a series of reports. I isolated one source of allocation in the v26.12.3 packager. Collecting ReadAllBytes through a PowerShell if expression enumerates the dump byte by byte before writing it to the ZIP. This change streams dumps into the ZIP and writes the existing screenshot and contact-sheet byte buffers directly.

I ran the included test in three fresh PowerShell 7.4.19 processes per version on Linux. Packing a synthetic 4 MiB dump allocated 346.7 MiB on the release and 18.8 MiB with this change each time. Every extracted dump matched the source SHA-256. With a 256 KiB limit, each version omitted the dump and retained the run log. To reproduce, run pwsh -NoProfile -File tests/report-dump-memory.ps1 -Repo <launcher directory> against each checkout.

These measurements cover managed allocations during packaging. The cause of the tester’s sustained 5 GB working set remains unverified.

<!-- greyfinch-sync:PastiiJay/klbf-lab:issue:5589567059 --> Imported from [PastiiJay/klbf-lab](https://github.com/PastiiJay/klbf-lab/pull/438). Originally posted by [HandshakeHackin](https://github.com/HandshakeHackin) on 2026-12-01T16:08:42Z. --- The tester in #437 observed 5 GB of launcher memory after a series of reports. I isolated one source of allocation in the v26.12.3 packager. Collecting `ReadAllBytes` through a PowerShell `if` expression enumerates the dump byte by byte before writing it to the ZIP. This change streams dumps into the ZIP and writes the existing screenshot and contact-sheet byte buffers directly. I ran the included test in three fresh PowerShell 7.4.19 processes per version on Linux. Packing a synthetic 4 MiB dump allocated 346.7 MiB on the release and 18.8 MiB with this change each time. Every extracted dump matched the source SHA-256. With a 256 KiB limit, each version omitted the dump and retained the run log. To reproduce, run `pwsh -NoProfile -File tests/report-dump-memory.ps1 -Repo <launcher directory>` against each checkout. These measurements cover managed allocations during packaging. The cause of the tester’s sustained 5 GB working set remains unverified.
HandshakeHackin commented 2026-12-01 16:27:49 +00:00 (Migrated from github.com)

Imported from PastiiJay/klbf-lab. Originally posted by HandshakeHackin on 2026-12-01T16:27:49Z.


I also measured repeated packaging in a single process, closer to the sequence in #437. The test at 49315d1 accepts -Repeat 8. I ran three fresh processes per version on Linux PowerShell 7.4.19, each packing the same synthetic 4 MiB dump eight times. The baseline was the launcher from the published v26.12.3 Windows archive.

Peak process working set during eight packs Trial 1 Trial 2 Trial 3
v26.12.3 552.1 MiB 545.7 MiB 544.9 MiB
This PR 180.9 MiB 191.0 MiB 185.1 MiB

All 48 extracted dumps matched their source SHA-256, and the size-limit retry retained the log in all six processes. These peaks include the PowerShell host and the test. A long Windows session with the tester’s actual reports is still needed to explain the original 5 GB reading.

<!-- greyfinch-sync:PastiiJay/klbf-lab:comment:7317647587 --> Imported from [PastiiJay/klbf-lab](https://github.com/PastiiJay/klbf-lab/pull/438#issuecomment-7317647587). Originally posted by [HandshakeHackin](https://github.com/HandshakeHackin) on 2026-12-01T16:27:49Z. --- I also measured repeated packaging in a single process, closer to the sequence in #437. The test at 49315d1 accepts `-Repeat 8`. I ran three fresh processes per version on Linux PowerShell 7.4.19, each packing the same synthetic 4 MiB dump eight times. The baseline was the launcher from the published v26.12.3 Windows archive. | Peak process working set during eight packs | Trial 1 | Trial 2 | Trial 3 | | --- | ---: | ---: | ---: | | v26.12.3 | 552.1 MiB | 545.7 MiB | 544.9 MiB | | This PR | 180.9 MiB | 191.0 MiB | 185.1 MiB | All 48 extracted dumps matched their source SHA-256, and the size-limit retry retained the log in all six processes. These peaks include the PowerShell host and the test. A long Windows session with the tester’s actual reports is still needed to explain the original 5 GB reading.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/438:upstream-pr/438'
git switch 'upstream-pr/438'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'v26123'
git merge --no-ff 'upstream-pr/438'
git switch 'upstream-pr/438'
git rebase 'v26123'
git switch 'v26123'
git merge --ff-only 'upstream-pr/438'
git switch 'upstream-pr/438'
git rebase 'v26123'
git switch 'v26123'
git merge --no-ff 'upstream-pr/438'
git switch 'v26123'
git merge --squash 'upstream-pr/438'
git switch 'v26123'
git merge --ff-only 'upstream-pr/438'
git switch 'v26123'
git merge 'upstream-pr/438'
git push origin 'v26123'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
PastiiJay/klbf-lab!438
No description provided.