Skip to content

Large arrays cause stackoverflows at runtime when compiled without --release #72922

@MEisebitt

Description

@MEisebitt

Large arrays (in my case [f64; 1_000_000]) cause a stackoverflow at runtime if the program is run without --release. For smaller arrays ([f64; 100_000]) it works with and without --release.

I used this code:

fn main() {
    let _values: [f64; 1_000_000] = [3.5; 1_000_000];
}

When run with

cargo run --release

everything worked, but when run with

cargo run

the result was

thread 'main' has overflowed its stack
error: process didn't exit successfully: `target\debug\playground.exe` (exit code: 0xc00000fd, STATUS_STACK_OVERFLOW)

Sadly I got no backtrace, even though I enabled it.

Metadata
rustc 1.43.1 (8d69840 2020-05-04)
binary: rustc
commit-hash: 8d69840
commit-date: 2020-05-04
host: x86_64-pc-windows-msvc
release: 1.43.1
LLVM version: 9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions