Zulip Chat Archive
Stream: lean4 dev
Topic: Prevent memory exhaustion
Leni Aniva (Apr 27 2025 at 00:43):
Would it be possible to add a feature where we can run a Lean function with a different allocator?
In the past I have encountered problems where tactics would exhaust the memory on the host machine, forcing the host machine to reboot.
Henrik Böving (Apr 27 2025 at 07:10):
How would running specific functions of your program with a custom allocator alleviate this problem?
Sebastian Ullrich (Apr 27 2025 at 10:43):
We already have lean --memory
Leni Aniva (Apr 27 2025 at 16:53):
Sebastian Ullrich said:
We already have
lean --memory
What if I call a function via FFI
Leni Aniva (Apr 27 2025 at 16:54):
Henrik Böving said:
How would running specific functions of your program with a custom allocator alleviate this problem?
If a tactic makes unbounded amount of allocations that exceed a limit, the allocator could deny the allocation request and return an error?
Sebastian Ullrich (Apr 27 2025 at 17:03):
There are far better OS primitives for this job such as Linux cgroups
Eric Wieser (Apr 27 2025 at 18:04):
I don't think Lean code can recover from a C++ std::bad_alloc
Eric Wieser (Apr 27 2025 at 18:05):
That is, all that could happen upon denial is the process terminating, which may as well be handled by the OS.
Last updated: May 02 2025 at 03:31 UTC