libsupport_zynq/ram: print heap usage on alloc error.

This commit is contained in:
pca006132 2020-07-17 16:16:01 +08:00
parent c0c3bcb6cc
commit 1bb0122034
1 changed files with 7 additions and 1 deletions

View File

@ -90,5 +90,11 @@ pub fn init_alloc_core1() {
#[alloc_error_handler] #[alloc_error_handler]
fn alloc_error(layout: core::alloc::Layout) -> ! { fn alloc_error(layout: core::alloc::Layout) -> ! {
panic!("Core {} alloc_error, layout: {:?}", MPIDR.read().cpu_id(), layout); let id = MPIDR.read().cpu_id();
let heap = if id == 0 {
ALLOCATOR.0.lock()
} else {
ALLOCATOR.1.lock()
};
panic!("Core {} alloc_error, layout: {:?}, used memory: {}", id, layout, heap.used());
} }