Skip to main content

Module alloc

Module alloc 

Source
Expand description

A GlobalAlloc implementation backed by the POSIX heap (malloc/free/posix_memalign).

cFS apps that want to use the alloc crate (Box, Vec, String, …) declare this as their global allocator:

use leodos_libcfs::os::alloc::CfsAllocator;

#[global_allocator]
static ALLOCATOR: CfsAllocator = CfsAllocator;

Alternatively, apps can call crate::register_allocator! at crate root to install the allocator with one line.

Under NOS3 / posix-OSAL, core-cpu1 is a normal Linux process, so this just delegates to the C library’s thread-safe heap.

Structs§

CfsAllocator
A GlobalAlloc backed by libc’s thread-safe heap.