Document more EspAlloc invariants (#1474)

This commit is contained in:
Scott Mabin 2024-04-22 15:41:46 +01:00 committed by GitHub
parent 7e5895c5fd
commit 4d44f4179e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -97,10 +97,12 @@ impl EspHeap {
///
/// # Safety
///
/// Obey these or Bad Stuff will happen.
///
/// - The supplied memory region must be available for the entire program (a
/// `'static` lifetime).
/// - The supplied memory region must be exclusively available to the heap
/// only, no aliasing.
/// - This function must be called exactly ONCE.
/// - `size > 0`
/// - `size > 0`.
pub unsafe fn init(&self, heap_bottom: *mut u8, size: usize) {
critical_section::with(|cs| self.heap.borrow(cs).borrow_mut().init(heap_bottom, size));
}