3个不稳定版本
0.2.0 | 2023年11月11日 |
---|---|
0.1.1 | 2019年8月13日 |
0.1.0 | 2019年8月13日 |
#232 in 内存管理
15KB
164 行
alloc_geiger
一个在活跃时发出声音的Rust分配器,类似于盖革计数器。
使用rodio
库在每次使用分配器时发出sinc脉冲,不包括其自身的分配器活动。
受Malloc Geiger启发。
用法
要使用alloc_geiger
,请将其作为依赖项添加
# Cargo.toml
[dependencies]
alloc_geiger = "0.2"
要将alloc_geiger::Geiger
设置为全局分配器,它必须使用基本分配器初始化。类型别名type System
及其const SYSTEM
使其易于使用默认的系统分配器
#[global_allocator]
static ALLOC: alloc_geiger::System = alloc_geiger::SYSTEM;
类似jemallocator
的替代方案也可以使用
use alloc_geiger::Geiger;
use jemallocator::Jemalloc;
#[global_allocator]
static ALLOC: Geiger<Jemalloc> = Geiger::new(Jemalloc);
许可
本项目许可为以下之一
- Apache License, Version 2.0, (LICENSE-APACHE 或 https://apache.ac.cn/licenses/LICENSE-2.0)
- MIT许可 (LICENSE-MIT 或 http://opensource.org/licenses/MIT)
由你选择。
贡献
除非你明确声明,否则你提交给alloc_geiger
的任何贡献,按照Apache-2.0许可的规定,应以上述双重许可方式提供,不附加任何额外的条款或条件。
依赖
~0.7–30MB
~442K SLoC