canic-memory 0.27.3

Canic — a canister orchestration and management toolkit for the Internet Computer
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use canic_cdk::structures::{DefaultMemoryImpl, memory::MemoryManager};
use std::cell::RefCell;

// -----------------------------------------------------------------------------
// MEMORY_MANAGER
// -----------------------------------------------------------------------------
// Shared stable-memory manager used by all Canic consumers. Stored as a
// thread-local so stable structures can grab virtual memory slots without
// global mutable state.
// -----------------------------------------------------------------------------

thread_local! {
    pub static MEMORY_MANAGER: RefCell<MemoryManager<DefaultMemoryImpl>> =
        RefCell::new(MemoryManager::init(DefaultMemoryImpl::default()));
}