4 ms·
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 construct
by Xylakant 5y ago
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
- umanwizard 5y agofn maybe_alloc() -> Vec<usize> { if collatz_conjecture_is_true() { vec![42] } else { vec![] } } fn main() { let v = maybe_alloc(); // Does this allocate? }
- wtetzner 5y agoYou would just assume it does. Really you want to detect all places that might allocate.
- umanwizard 5y agoYou are right. It’s definitely possible if you accept false positives.