-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Closed as duplicate of#43596
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.
Description
When memory allocation fails (for example when extending a Vec), a Rust program prints "memory allocation of xxx bytes failed" and aborts This message would be more helpful if it told you where the allocation happened by printing a backtrace. No backtrace is inconsistent with panics, which print a backtrace. A memory allocation feels like a panic so I expect to get a backtrace.
I understand there might be technical reasons for why this is hard. I'm still reporting this because from a user perspective this is wrong and we might be able to improve it. I didn't find a previous issue talking about this.
Linux, Rust 1.90.0
example program, playground
fn main() {
foo();
}
fn foo() {
// panic!();
let mut v = Vec::new();
v.resize(1000000000000, 1u8);
// Print pointer so vector doesn't get optimized out.
let ptr = v.as_ptr();
println!("{ptr:?}");
}
Metadata
Metadata
Assignees
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.