pub struct MemoryAllocator(/* private fields */);Expand description
An allocator RocksDB uses for cache block memory instead of the system one.
Pass it to set_memory_allocator on LruCacheOptions or
HyperClockCacheOptions before building the cache. One allocator can
back several caches. Cloning is cheap and hands out another reference to
the same allocator.
The allocator is ignored for compression libraries that allocate internally (currently only XPRESS).
Implementations§
Source§impl MemoryAllocator
impl MemoryAllocator
Sourcepub fn new_jemalloc_nodump() -> Result<Self, Error>
pub fn new_jemalloc_nodump() -> Result<Self, Error>
Creates a jemalloc allocator that keeps its memory out of core dumps.
The allocator serves every request from one dedicated jemalloc arena
and marks that arena MADV_DONTDUMP. A block cache built on it
therefore does not land in a core dump, which for a multi-gigabyte
cache is the difference between a usable dump and an unusable one.
Using a single arena also cuts jemalloc metadata, and jemalloc’s
thread-local cache is left on to keep the arena’s mutex from becoming
a bottleneck.
§Errors
Fails with Not implemented: Not compiled with JEMALLOC when the
linked librocksdb has no jemalloc support. That depends on how
librocksdb itself was built, which this crate’s jemalloc feature
controls only for a vendored build. An externally supplied librocksdb
can have jemalloc with the feature off, or lack it with the feature on,
so check the result rather than the feature.
Trait Implementations§
Source§impl Clone for MemoryAllocator
impl Clone for MemoryAllocator
Source§fn clone(&self) -> MemoryAllocator
fn clone(&self) -> MemoryAllocator
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more