Struct pyembed::PythonMemoryAllocator
source · [−]pub struct PythonMemoryAllocator { /* private fields */ }
Expand description
Represents a custom memory allocator that can be registered with Python.
Implementations
sourceimpl PythonMemoryAllocator
impl PythonMemoryAllocator
sourcepub fn from_backend(backend: MemoryAllocatorBackend) -> Option<Self>
pub fn from_backend(backend: MemoryAllocatorBackend) -> Option<Self>
Construct an instance from a MemoryAllocatorBackend
.
Returns None
if the backend shouldn’t be defined.
pub fn jemalloc() -> Self
pub fn mimalloc() -> Self
pub fn snmalloc() -> Self
sourcepub fn backend(&self) -> MemoryAllocatorBackend
pub fn backend(&self) -> MemoryAllocatorBackend
Obtain the backend used for this instance.
sourcepub fn set_allocator(&self, domain: PyMemAllocatorDomain)
pub fn set_allocator(&self, domain: PyMemAllocatorDomain)
Set this allocator to be the allocator for a certain “domain” in a Python interpreter.
This should be called before Py_Initialize*()
.
sourcepub fn set_arena_allocator(&self)
pub fn set_arena_allocator(&self)
Set the arena allocator used by the pymalloc
allocator.
This only has an effect if the pymalloc
allocator is registered to the
mem
or object
allocator domains.
Auto Trait Implementations
impl RefUnwindSafe for PythonMemoryAllocator
impl !Send for PythonMemoryAllocator
impl !Sync for PythonMemoryAllocator
impl Unpin for PythonMemoryAllocator
impl UnwindSafe for PythonMemoryAllocator
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more