#allocator #error #ps-alloc

ps-alloc

a reasonably safe allocator

6 releases

0.1.0-6 Apr 13, 2025
0.1.0-5 Apr 12, 2025
0.1.0-4 Apr 6, 2025
0.1.0-3 Jan 26, 2025

#337 in Memory management

Download history 267/week @ 2025-01-22 77/week @ 2025-01-29 20/week @ 2025-02-05 17/week @ 2025-02-19 1/week @ 2025-02-26 11/week @ 2025-03-12 127/week @ 2025-04-02 250/week @ 2025-04-09 71/week @ 2025-04-16

448 downloads per month
Used in 7 crates (via ps-buffer)

GPL-3.0-or-later

9KB
135 lines

ps-alloc - a reasonably safe allocator

This crate provides two methods - alloc and free.

While this crate does implement several safety precautions, you still shouldn't call free on stuff willy-nilly, because that is undefined behaviour.

free is NOT guaranteed to fail when provided anything other than a valid pointer allocated by alloc.

Do not call free any pointers not allocated by alloc.

Both alloc and free return Results. alloc returning an Err does not signify a problem. free returning any error besides NullPtr means your program is alredy in an undefined state and you should consider aborting it.

Dependencies

~210–640KB
~15K SLoC