Skip to content

SourceAccessor::readFile should be streaming in constant memory #11001

Open
@roberth

Description

Describe the bug

This reads a whole file into memory.

void SourceAccessor::readFile(
    const CanonPath & path,
    Sink & sink,
    std::function<void(uint64_t)> sizeCallback)
{
    std::string s = readFile(path);
    sizeCallback(s.size());
    sink(s);
}

Steps To Reproduce

Expected behavior

Multiple sink(chunk) calls.

nix-env --version output

Additional context

Priorities

Add 👍 to issues you find important.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    fetchingNetworking with the outside (non-Nix) world, input lockingperformance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions