News for hackers. Stuff that matters.
Re:Dealing with Out-of-Memory Conditions in Rust by Xylakant on Saturday August 14, 2021 @11:06AM (#28181209)
I’m fairly certain that this does not require solving the halting problem. Fundamentally, every line of code can be transformed to the underlying code constructs, and those could be checked for allocations. Doing this in an efficient manner is probably hard, but certainly not impossible
Re:Dealing with Out-of-Memory Conditions in Rust by umanwizard on Sunday August 15, 2021 @12:07AM (#28186190)

    fn maybe_alloc() -> Vec<usize> {
        if collatz_conjecture_is_true() {
            vec![42]
        } else {
            vec![]
        }
    }

    fn main() {
        let v = maybe_alloc(); // Does this allocate?
    }
Re:Dealing with Out-of-Memory Conditions in Rust by wtetzner on Sunday August 15, 2021 @09:35AM (#28188662)
You would just assume it does. Really you want to detect all places that might allocate.
Re:Dealing with Out-of-Memory Conditions in Rust by umanwizard on Sunday August 15, 2021 @10:49AM (#28189196)
You are right. It’s definitely possible if you accept false positives.