{{ message }}
Repository navigation
Copy files with bounded memory through File - #806
Open
snowyukitty wants to merge 2 commits into
Open
snowyukitty wants to merge 2 commits into
snowyukitty wants to merge 2 commits into
Conversation
rokups
requested changes
Oct 12, 2026
Member
There was a problem hiding this comment.
All of this seems largely unnecessary. All you had to do is to add a loop around reading/writing calls using our File and reduce size of buffer. This code duplicates platform-specific functionality that File is meant to abstract.
Member
There was a problem hiding this comment.
Yep. FileSystem::Copy has no place for platform-specific code.
Author
This branch has not been deployed
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.

Addresses the whole-file allocation in #798.
Stream through the existing
File::CopyAPI using a reusable buffer of at most 64 KiB, and letFileSystem::Copydelegate to it. Both existing APIs avoid a whole-file allocation. File opening, native handles, asset handling and flush error checking stay insideFile;FileSystemkeeps its access checks.Check each read and write, and report a buffered-write flush failure before returning success. Preserve overwrite/truncation, Unicode paths, empty files and missing-source behavior. The existing
Filesize limits remain unchanged; this patch does not add a 64-bit file API or support for files above that limit.Native regressions cover both entry points, buffer boundaries, Unicode paths, overwrite/truncation, empty files, missing sources, access restrictions and Linux buffered-write failures. A separate hidden
[large-file]test copies 2 GiB + 65,537 bytes and compares every byte; run it explicitly withTests "[large-file]". It reports that the regression was not run on platforms whose signed-long offsets cannot represent the file.Validation on Linux: 188 ordinary native cases pass, plus the large-file case under a 1 GiB virtual-memory limit. Restoring the original
File::Copyreproduces buffered-output failures and allocation failure in the large copy. The build uses GCC 12 and a reduced feature set. Windows, macOS and Android were not run locally.