1 unstable release

0.2.0 Jul 11, 2023

#505 in Memory management

Download history 13/week @ 2024-02-19 10/week @ 2024-02-26 23/week @ 2024-04-01 67/week @ 2024-04-15 8/week @ 2024-04-22

98 downloads per month
Used in lock_freedom

MIT license

32KB
646 lines

Owned Alloc

Warning

This library is only temporary.

This is an attempt of reducing erros with manual memory allocation in Rust. See docs for more details.

Docs: https://bzim.gitlab.io/owned-alloc/owned_alloc/


lib.rs:

Owned Allocations. A crate to help reducing manual memory management errors.

The idea is to use a type like UninitAlloc for uninitialized dynamic allocations. After initializing it, you have a OwnedAlloc which is pretty similar to a Box. However, unlike a Box, you may move the value out from the OwnedAlloc and getting an UninitAlloc back.

For vec-like structures, a type RawVec is available, pretty similar to the one used by the standard library. Currently, no other help is provided for arrays/vectors.

There is also a type Cache, which is actually more general than allocation, but may be useful for allocations. It can save unused allocations requested on a tight loop.

No runtime deps