pub struct GlobalMemoryManager {
string_pool: Arc<Mutex<StringPool>>,
vec_pool: Arc<Mutex<VecPool<String>>>,
memory_stats: Arc<Mutex<MemoryStats>>,
}Expand description
全局内存管理器
Fields§
§string_pool: Arc<Mutex<StringPool>>§vec_pool: Arc<Mutex<VecPool<String>>>§memory_stats: Arc<Mutex<MemoryStats>>内存使用统计
Implementations§
Source§impl GlobalMemoryManager
impl GlobalMemoryManager
Sourcepub fn acquire_string(&self, initial_capacity: usize) -> String
pub fn acquire_string(&self, initial_capacity: usize) -> String
获取字符串
Sourcepub fn release_string(&self, string: String)
pub fn release_string(&self, string: String)
释放字符串
Sourcepub fn acquire_vec(&self, initial_capacity: usize) -> Vec<String>
pub fn acquire_vec(&self, initial_capacity: usize) -> Vec<String>
获取向量
Sourcepub fn release_vec(&self, vec: Vec<String>)
pub fn release_vec(&self, vec: Vec<String>)
释放向量
Sourcepub fn get_stats(&self) -> MemoryStats
pub fn get_stats(&self) -> MemoryStats
获取内存统计
Sourcepub fn get_pool_stats(&self) -> (PoolStats, usize)
pub fn get_pool_stats(&self) -> (PoolStats, usize)
获取池统计
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GlobalMemoryManager
impl RefUnwindSafe for GlobalMemoryManager
impl Send for GlobalMemoryManager
impl Sync for GlobalMemoryManager
impl Unpin for GlobalMemoryManager
impl UnwindSafe for GlobalMemoryManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more