Skip to content

Large memory usage and long time on compiling large number of println #86244

Open
@upsuper

Description

@upsuper

Not sure whether it's a known bug.

I tried this code:

fn main() {
    println!("hello world!"); // repeat 16384 times
}

(To save you some time, you can download the file here directly rather than generating it yourself.)

I expected to see this happen: it should take reasonable amount of memory and reasonable time to compile.

Instead, this happened: on my machine, I saw it took up to 34GB memory and 2.5min of time just to compile this.

Meta

rustc --version --verbose:

rustc 1.52.1 (9bc8c42bb 2021-05-09)
binary: rustc
commit-hash: 9bc8c42bb2f19e745a63f3445f1ac248fb015e53
commit-date: 2021-05-09
host: x86_64-unknown-linux-gnu
release: 1.52.1
LLVM version: 12.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-borrow-checkerArea: The borrow checkerC-bugCategory: This is a bug.I-compilememIssue: Problems and improvements with respect to memory usage during compilation.I-compiletimeIssue: Problems and improvements with respect to compile times.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions