Memory Leak when calling .to_string_radix() on rug::Float
How to reproduce
Rug Version: "1.5.0"
main.rs:
use rug::Float;
fn main() {
let precision: u32 = 246_137_416;
for i in 0..200 {
eprintln!("i: {}", i);
let mut x = Float::with_val(precision, i);
x.sqrt_mut();
x.to_string_radix(16, None);
}
}
Rust Versions: tested on both rustc 1.36.0 (a53f9df32 2019-07-03)
and rustc 1.38.0-nightly (0b680cfce 2019-07-09)
And then: cargo run
and watch your memory usage fly!
Expected result
fn main() {
for i in 0..2_000_000_000 {
if i % 1_000_000 == 0 {
eprintln!("{} million down!", i / 1_000_000);
}
let mut x = String::from("Here's another banana!!");
}
}
cargo run
and watch your memory stay happy
Anyways..
I haven't tested this with other functions, it just happens to be that .sqrt()
is what I've been using, but it could certainly exists elsewhere.
note: thanks for your work on rug! It's been very helpful
Edited by Michael