Repository navigation
Conversation
The decoder kept the zip buffer, the compressed file cache, all decoded RGBA images and full-size f32 arrays alive at the same time, which exceeds the 4 GiB wasm32 limit on large files (~40M splats). - finish() moves the zip buffer into decode_sogs, dropped after preload - cache entries are removed on their last use - compressed bytes are dropped right after each image decode - splats are emitted in MAX_SPLAT_CHUNK blocks via set_batch, with reused buffers; shN centroids/labels are loaded once and decoded per block - tests: 70k-splat v1/v2 SOG zips with 3 SH bands, compared against a per-splat reference Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Fixes #490
Cause
SogsDecoderkept everything alive at the same time: the zip buffer, the cache of compressed files, the five decoded RGBA images, full-size f32 arrays for every property, plus the receivingPackedSplats. On a 39.5M-splat SOG this adds up to about 4.5 GB, over the 4 GiB wasm32 address space. The allocation failure aborts, which surfaces asunreachablein the worker.Changes (
rust/spark-lib/src/sogs.rsonly)finish()takes the buffer withstd::mem::takeand passes it by value; the zip bytes are dropped right after the files are preloaded.get_fileremoves an entry from the cache on its last use (use count per name taken frommeta.json).MAX_SPLAT_CHUNKblocks with reused buffers, oneset_batchper block.Results (Chrome, SOG v2, 39,548,487 splats, 415 MB, no shN)
unreachable)No regression on a 9.3M-splat SOG and on a streamed SOG.
Tests
Two new tests build 70,000-splat SOG zips in memory (more than one chunk, last one partial), v1 and v2, with 3 shN bands, feed them to
SogsDecoderin several pushes and compare every value against a per-splat reference (relative tolerance 1e-6).The memory64 fix proposed in #490 is independent and not included here.