(&self, layout: std::alloc::Layout)
| 25 | #[cold] |
| 26 | #[inline(never)] |
| 27 | fn print_alloc_failure(&self, layout: std::alloc::Layout) { |
| 28 | let mut stderr = std::io::stderr().lock(); |
| 29 | let _ = writeln!( |
| 30 | stderr, |
| 31 | "allocation of {} bytes failed, attempting to capture backtrace", |
| 32 | layout.size() |
| 33 | ); |
| 34 | let bt = std::backtrace::Backtrace::force_capture(); |
| 35 | let _ = write!(stderr, "{bt}"); |
| 36 | let _ = stderr.flush(); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | unsafe impl GlobalAlloc for DebuggingAlloc { |