Skip to content

A simple global allocator for Rust which hooks into `libc`. Useful in `no_std` contexts.

Notifications You must be signed in to change notification settings

CxdInitial/libc_alloc

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libc_alloc

A simple global allocator for Rust which hooks into libc. Useful when linking no_std + alloc code into existing embedded C code.

On Unix-like OSs, use posix_memalign for allocations, realloc for reallocations, and free for deallocations.

On Windows, use native _aligned_malloc for allocations, _aligned_realloc for reallocations, and _aligned_free for deallocations.

Example

use libc_alloc::LibcAlloc;

#[global_allocator]
static ALLOCATOR: LibcAlloc = LibcAlloc;

Project Status

Given how dead-simple this crate is, I doubt it will need to be updated very often (if at all).

Please file an issue and/or open a PR if you spot a bug / if something stops working.

About

A simple global allocator for Rust which hooks into `libc`. Useful in `no_std` contexts.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%