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

A lint for large stack allocation #827

Closed
cramertj opened this issue Apr 2, 2016 · 7 comments
Closed

A lint for large stack allocation #827

cramertj opened this issue Apr 2, 2016 · 7 comments
Labels
A-lint Area: New lints good-first-issue These issues are a good way to get started with Clippy L-correctness Lint: Belongs in the correctness lint group T-middle Type: Probably requires verifiying types

Comments

@cramertj
Copy link
Member

cramertj commented Apr 2, 2016

Stack allocation of large arrays, such as [0; 8388608] should be an error-- they will cause stack overflows.

@llogiq
Copy link
Contributor

llogiq commented Apr 2, 2016

Is this still true? I thought we were already resizing the stack when needed. Am on mobile right now, but will check.

@cramertj
Copy link
Member Author

cramertj commented Apr 2, 2016

I just tried it on the latest nightly and got an overflow.

@llogiq
Copy link
Contributor

llogiq commented Apr 2, 2016

OK then. Perhaps it makes sense to check stack sizes on a number of systems first so we can report on what systems an allocation would certainly fail?

@cramertj
Copy link
Member Author

cramertj commented Apr 2, 2016

I believe the minimum stack size is available via the environmental variable RUST_MIN_STACK

@llogiq
Copy link
Contributor

llogiq commented Apr 2, 2016

I know. However the value of that variable varies from system to system. For some, 'it runs on my machine' may be OK, but many folks I know want their code to run on other systems, too (or at least aren't directly opposed to that)...

@cramertj
Copy link
Member Author

cramertj commented Apr 2, 2016

Right-- I was just pointing it out as an easy way to check the maximum size on different systems.

@oli-obk oli-obk added L-correctness Lint: Belongs in the correctness lint group good-first-issue These issues are a good way to get started with Clippy A-lint Area: New lints T-middle Type: Probably requires verifiying types labels May 10, 2017
@basil-cow
Copy link
Contributor

@flip1995 I suggest closing this in favor of #4520, as it has more recent and relevant info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints good-first-issue These issues are a good way to get started with Clippy L-correctness Lint: Belongs in the correctness lint group T-middle Type: Probably requires verifiying types
Projects
None yet
Development

No branches or pull requests

6 participants