9个版本
0.1.8 | 2024年7月21日 |
---|---|
0.1.7 | 2024年7月19日 |
73 在 内存管理 中
每月下载量 13,068
在 110 个Crate中使用(7个直接使用)
47KB
1K SLoC
swc的分配器。
功能
scoped
:启用scoped
模式。
模式
默认模式
在默认模式下,crate::boxed::Box 和 crate::vec::Vec 与 [std] 中的原始类型相同。
作用域模式
- 您需要启用
scoped
功能才能使用此模式。
在 scoped
模式下,您可以使用 [FastAlloc] 使 crate::boxed::Box 和 crate::vec::Vec 非常快。
在此模式中,您在使用 crate::boxed::Box 和 crate::vec::Vec 时需要小心。您应确保 [Allocator] 在作用域内存在,并且所有在作用域内创建的 crate::boxed::Box 和 crate::vec::Vec 都存在。
推荐使用此模式的方式是将整个操作包裹在对 Allocator::scope 的调用中。
依赖
~4MB
~72K SLoC