https://github.com/maulingmonkey/ialloc
Allocator interface traits for Rust
https://github.com/maulingmonkey/ialloc
alloc allocator ialloc rust
Last synced: 9 months ago
JSON representation
Allocator interface traits for Rust
- Host: GitHub
- URL: https://github.com/maulingmonkey/ialloc
- Owner: MaulingMonkey
- License: apache-2.0
- Created: 2023-05-01T00:57:32.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-01-26T14:25:40.000Z (almost 2 years ago)
- Last Synced: 2024-10-14T04:22:41.482Z (about 1 year ago)
- Topics: alloc, allocator, ialloc, rust
- Language: Rust
- Homepage:
- Size: 564 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 19
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# ialloc
Allocator interface traits for Rust
[](https://github.com/MaulingMonkey/ialloc)
[](https://crates.io/crates/ialloc)
[](https://docs.rs/ialloc)
[](https://github.com/MaulingMonkey/ialloc/search?q=unsafe+path%3Ars)
[](https://github.com/MaulingMonkey/ialloc)
[](https://github.com/MaulingMonkey/ialloc/actions?query=workflow%3Arust)
## Raison d'être
* Why not [`core::alloc::Allocator`](https://doc.rust-lang.org/core/alloc/trait.Allocator.html) / [`allocator_api`](https://github.com/rust-lang/rust/issues/32838)?
* 7+ years unstabilized and counting.
* I want container allocations this decade, thanks!
* We can aim to be compatible and interopable with it, if/when it stabilizes, or via separate nightly crates.
* Why not [`core::alloc::GlobalAlloc`](https://doc.rust-lang.org/core/alloc/trait.GlobalAlloc.html)?
* Win32 [`FreeSid`](https://learn.microsoft.com/en-us/windows/win32/api/securitybaseapi/nf-securitybaseapi-freesid)
has no equivalent arbitrary allocation function to implement
[`GlobalAlloc::alloc`](https://doc.rust-lang.org/core/alloc/trait.GlobalAlloc.html#tymethod.alloc) with.
* [bgfx](https://github.com/bkaradzic/bgfx#readme)::[alloc](https://bkaradzic.github.io/bgfx/bgfx.html#bgfx::alloc__uint32_t)
has no equivalent arbitrary free function to implement
[`GlobalAlloc::dealloc`](https://doc.rust-lang.org/core/alloc/trait.GlobalAlloc.html#tymethod.dealloc) with.
* Split alloc/free/realloc traits will help avoid bugs and misuse!
* That said, we can aim to be compatible and interopable with it.
* Rust-style traits are annoying to adapt to C-style allocators. This provides more C-friendly traits as options.
## Out of scope
* NUMA? Although ask again later.
* Physical GPU memory allocation, probably. Might warrant a related crate?
* ID/handle allocation, perhaps. Might warrant a related crate?
## License
Licensed under either of
* Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or )
* MIT license ([LICENSE-MIT](LICENSE-MIT) or )
at your option.
## Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.