# slab_allocator_rs **Repository Path**: vitors/slab_allocator_rs ## Basic Information - **Project Name**: slab_allocator_rs - **Description**: 给 rt-thread rust 版本使用的内存管理系统之slab算法 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-06-17 - **Last Updated**: 2021-06-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # slab_allocator_rs ## Usage Create a static allocator in your root module: ```rust use slab_allocator::LockedHeap; #[global_allocator] static ALLOCATOR: LockedHeap = LockedHeap::empty(); ``` Before using this allocator, you need to init it: ```rust pub fn init_heap() { let heap_start = …; let heap_end = …; let heap_size = heap_end - heap_start; unsafe { ALLOCATOR.init(heap_start, heap_size); } } ``` ## License This crate is licensed under MIT. See LICENSE for details. This is an updated fork of https://github.com/weclaw1/slab_allocator