-
Notifications
You must be signed in to change notification settings - Fork 424
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
Excessive memory consumption for processing simple file. #5321
Comments
Thanks for the report, and going through the lengths of making it reproducible, even with a docker image. It looks like you are trying to reduce a function defined by well-founded recursion. This usually fails, even for small examples like this one, so this is probably a duplicate of #2171. Note that since from Lean 4.12 on (#3772) |
Thanks for the quick response. Not sure what that means. I'm quite a Lean beginner. So do you mean 4.12.0 would also resolve the memory issue? For more context: I was just typing in my editor and then my system would totally freeze suddenly. Turns out the Can you recommend some reasonable default memory limit? |
Yes, with it you shouldn’t be able to trigger the freeze here. That said, presumably there might be other ways to freeze it up like this, and that’s certainly an issue. I don’t know if it’s a known one. Leaving open for the triage team to look at it in due course. And with 4.12 the above proof won’t go |
The Lean process, spawned by the language server, might use excessive memory in certain situation, causing the entire system to freeze. See: leanprover/lean4#5321 The language server accepts a CLI flag for limiting memory use. I set it to 1024MB, which might be a bit arbitrary, but definitly prevents the system from crashing.
The Lean process, spawned by the language server, might use excessive memory in certain situation, causing the entire system to freeze. See: leanprover/lean4#5321 The language server accepts a CLI flag for limiting memory use. I set it to 1024MB, which might be a bit arbitrary, but definitly prevents the system from crashing.
) The Lean process, spawned by the language server, might use excessive memory in certain situation, causing the entire system to freeze. See: leanprover/lean4#5321 The language server accepts a CLI flag for limiting memory use. I set it to 1024MB, which might be a bit arbitrary, but definitly prevents the system from crashing.
) The Lean process, spawned by the language server, might use excessive memory in certain situation, causing the entire system to freeze. See: leanprover/lean4#5321 The language server accepts a CLI flag for limiting memory use. I set it to 1024MB, which might be a bit arbitrary, but definitly prevents the system from crashing.
Prerequisites
Please put an X between the brackets as you perform the following steps:
https://github.com/leanprover/lean4/issues
Avoid dependencies to Mathlib or Batteries.
https://live.lean-lang.org/#project=lean-nightly
(You can also use the settings there to switch to “Lean nightly”)
Description
If I pass the following simple file to Lean, it seems to allocate unbounded amount of memory. I have to kill the process before my system freezes:
The function
digitsOf
is supposed to return a list of digits given some number. The problem seems to be theexample
. In particular, theby rfl
proof. Without it, memory use stays below 300MB on my machine.Screencast.from.2024-09-12.14-58-59.webm
If I use the CLI flag to limit memory use, I get the following output:
But there is nothing wrong with the proof, right? I get the same output on live.lean-lang.org.
Steps to Reproduce
Create the lean file mentioned above and run
lean the-file.lean
.Here is also a Dockerfile. With that, I can also reproduce the problem on Debian:
To build the Docker image, make sure the
digits.lean
file is in the same directory. Then run:docker build --tag demo .
To run
lean
inside Docker:On my machine memory use exploded. With or without Docker.
Versions
Tested both
Lean 4.9.0
andLean 4.11.0
.Tested on both
NixOS 24.11 (Vicuna)
andDebian Bookworm 12.7
.Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
The text was updated successfully, but these errors were encountered: