3 ms·
I just tried the following: let mut blah = ~MyStruct{x: 3, y: 4}; for i in range(0,100000000) { blah = ~MyStruct{x: i + blah.x, y:
by AlisdairO 13y ago
I just tried the following:
let mut blah = ~MyStruct{x: 3, y: 4};
for i in range(0,100000000) {
blah = ~MyStruct{x: i + blah.x, y: i + blah.y};
}
println!("{} {}", blah.x, blah.y);
The memory usage didn't increase over time - the owned pointer frees when it gets reassigned.
- azth 13y agoSee this example for more details: https://news.ycombinator.com/item?id=7665617 https://news.ycombinator.com/item?id=7665617