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

ICE: Out of memory error when compiling small boring code #16232

Closed
TyOverby opened this issue Aug 4, 2014 · 7 comments
Closed

ICE: Out of memory error when compiling small boring code #16232

TyOverby opened this issue Aug 4, 2014 · 7 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@TyOverby
Copy link
Contributor

TyOverby commented Aug 4, 2014

Seen on rustc 0.12.0-pre-nightly (4d4eb1023 2014-08-02 23:36:09 +0000)

When compiling my irc message parsing library rustc uses as much CPU and memory as it can before crashing due to either an out of memory exception or an "illegal instruction" (stack overflow?).

The weird thing about this is that a single change didn't introduce the bug. As I worked on it, compile times got slower and slower until my machine could no longer even build the project.

Uninterestingly, I'm not using macros or any other rust features that might have explosive properties.

@apoelstra
Copy link
Contributor

Can also reproduce on my system, Linux x86_64 with rustc d34e011b + PR 16208 + PR 15763. Halting in gdb always shows rustc sitting in Task::deschedule maybe 15 levels deep, so this is not a runaway recursion..

@huonw huonw added the I-ICE label Aug 4, 2014
@TyOverby
Copy link
Contributor Author

TyOverby commented Aug 4, 2014

"Restarting" the iterator types by collecting into a Vec and then iterating from there brings the compile time down from non-terminating to 11s.

@TyOverby
Copy link
Contributor Author

TyOverby commented Aug 4, 2014

Apparently one of the types of my iterators towards the end of my program when this bug was file was

core::iter::Peekable<char,core::iter::SkipWhile<'_,char,core::iter::ByRef<'_,core::iter::SkipWhile<'_,char,core::iter::SkipWhile<'_,char,core::iter::Peekable<char,core::iter::Peekable<char,core::iter::SkipWhile<'_,char,core::iter::Peekable<char,core::iter::Peekable<char,core::str::Chars<'_>>>>>>>>>>>

Since I think all the iterator methods are #[inline(always)], this might be breaking codegen pretty hilariously.

@apoelstra
Copy link
Contributor

I have been seeing similar symptoms during make check when compiling src/test/bench/shootout-fasta-redux.rs -- lots of memory usage (only 2.5-3Gb this time) and a pinned CPU in Task::deschedule.

A recent PR I was watching timed out on the Mac OSX build at the same point and was unable to merge. I'm on Linux 64, and the Linux 64 tests -did- pass, so I'd guess this is just an extreme slowdown and not a runaway loop.

Edit: The compile is quick and clean without -O; with -O I see this problem.

Edit2: No, the original bug report occurs even without optimizations, and even with old rustc's which do not have the unit test bug. (I am in the process of bisecting that one now.)

@bkoropoff
Copy link
Contributor

This looks very much like issue #15244

@TyOverby
Copy link
Contributor Author

TyOverby commented Aug 7, 2014

Yeah, I'd be willing to mark this as a duplicate.

@sfackler sfackler closed this as completed Aug 7, 2014
@sfackler
Copy link
Member

sfackler commented Aug 7, 2014

Closing as duplicate of #15244

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

5 participants