Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack getting overflowed when Im boxing an array #110042

Closed
0xN1nja opened this issue Apr 7, 2023 · 2 comments
Closed

Stack getting overflowed when Im boxing an array #110042

0xN1nja opened this issue Apr 7, 2023 · 2 comments
Labels
C-bug Category: This is a bug.

Comments

@0xN1nja
Copy link

0xN1nja commented Apr 7, 2023

I tried this code:

let a=Box::new([0;10000000]);

I expected that it would allocate array on the heap but instead, it panicked : thread 'main' has overflowed its stack

Meta

rustc --version --verbose:

rustc 1.68.0 (2c8cc3432 2023-03-06)
binary: rustc
commit-hash: 2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74
commit-date: 2023-03-06
host: x86_64-pc-windows-msvc
release: 1.68.0
LLVM version: 15.0.6
Backtrace

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

@0xN1nja 0xN1nja added the C-bug Category: This is a bug. label Apr 7, 2023
@Noratrieb
Copy link
Member

Thanks for the report, but I'll close it as a duplicate of #53827

@Noratrieb Noratrieb closed this as not planned Won't fix, can't repro, duplicate, stale Apr 7, 2023
@Noratrieb
Copy link
Member

But the recommend workaround is to use vec![0; 100000].into_boxed_slice().try_into().unwrap() instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants