Fix HSR 4.4 map-build OOM and apphost bin\bin\... path stacking - #100
Open
Momoko-Ayase wants to merge 2 commits into
Open
Fix HSR 4.4 map-build OOM and apphost bin\bin\... path stacking#100Momoko-Ayase wants to merge 2 commits into
Momoko-Ayase wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR targets two production pain points: (1) out-of-memory behavior during HSR 4.4 CAB/Asset map builds by reducing peak allocations and enabling per-bundle flushing/streaming, and (2) repeated AppHost patching that previously stacked bin\ segments across repeated build.ps1 runs.
Changes:
- Stream/flush map-build processing across multi-bundle
.blockcontainers and reduce retained allocations (object hashing, bundle decompression, string interning). - Avoid expensive
SerializedShaderparsing and skip hashing very large exportables during map builds to prevent large transient allocations. - Make the AppHost patcher idempotent and strengthen the build script to produce clean, non-stacked outputs.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| build.ps1 | Adds failure checks, output dir reset helper, and sanity checks to prevent repeated apphost repatching and ensure packaging layout. |
| AnimeStudio/EndianBinaryReader.cs | Reworks ReadBytes to avoid intermediate buffers/copies and reduce peak memory during large reads. |
| AnimeStudio/Classes/Object.cs | Streams xxHash computation to avoid allocating full raw object buffers during hashing. |
| AnimeStudio/BundleFile.cs | Adds size guards, uses shared decompressed buffers for zero-copy CAB slicing when possible, fixes trailer seeking for multi-bundle .block, and avoids ArrayPool retention for large Oodle blocks. |
| AnimeStudio/AssetsManager.cs | Adds per-bundle callback (AfterBundleLoaded), avoids unnecessary external dependency scans when not resolving deps, disposes duplicate readers, and introduces ClearLoadedAssets for incremental flushing. |
| AnimeStudio/AssetsHelper.cs | Refactors map builds to iterate per loaded bundle, adds streaming asset-map output path, skips full shader parsing, and adds periodic cache clears/GC to prevent OOM over huge dumps. |
| AnimeStudio/AssetMap.cs | Adds StringCache.Clear() and stops interning highly-unique Name/Hash fields to prevent unbounded cache growth. |
| AnimeStudio.Patcher/Program.cs | Makes patching idempotent, avoids suffix-matching that caused bin\ stacking, and adds recovery for previously stacked paths. |
Comments suppressed due to low confidence (1)
AnimeStudio/AssetsHelper.cs:1030
- Typo in log message: "buidling" should be "building".
Logger.Info($"Finished buidling AssetMap with {entryCount} assets.");
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
.blockbundles one at a time instead of retaining the whole game in RAM.SerializedShaderparsing during map builds (HSR shaders can exceed 100MB).bin\on everybuild.ps1run.