Skip to content

Fix HSR 4.4 map-build OOM and apphost bin\bin\... path stacking - #100

Open
Momoko-Ayase wants to merge 2 commits into
Escartem:masterfrom
Momoko-Ayase:master
Open

Fix HSR 4.4 map-build OOM and apphost bin\bin\... path stacking#100
Momoko-Ayase wants to merge 2 commits into
Escartem:masterfrom
Momoko-Ayase:master

Conversation

@Momoko-Ayase

Copy link
Copy Markdown

Copilot AI review requested due to automatic review settings July 24, 2026 20:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .block containers and reduce retained allocations (object hashing, bundle decompression, string interning).
  • Avoid expensive SerializedShader parsing 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.

Comment thread AnimeStudio/AssetsHelper.cs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

There was an issue with abnormal memory usage when building the Map in HSR 4.4

3 participants