Memory management classes for implementing usage constraints in parts of processes.
os
weakref0
collections0
Memory266%
bytearray subclass supporting weak-references and identifier hashing for memory-free signalling.
Memory__slots__0
__slots__ = ('__weakref__',)
Memory__hash__20%
__hash__(self)
Object Identifier based hash for allowing indexing of allocated instances.
MemoryContext0
Memory pool that uses weakref's and context managers to reclaim memory.
MemoryContextMemory0
Memory = Memory # bytearray subclass with weakref support
MemoryContextReference0
Reference = weakref.ref # for reclaiming memory
@classmethod
MemoryContextfrom_mib40%
from_mib(typ, size)
Construct a Reservoir from the given number of Mebibytes desired.
MemoryContext__init__70%
__init__(self)
MemoryContextused20%
Memory units currently in use.
MemoryContextavailable20%
Number of memory units available.
MemoryContextallocate60%
allocate(self)
Allocate a unit of memory for use. When Python references to the memory object no longer exist, another unit will be added.
MemoryContextreclaim40%
reclaim(self, memory)
MemoryContextacquire20%
acquire(self, event)
Explicitly add an object to the available segments.
Segments0
Iterate over the slices of an active memory map; Weak references of the slices are held to track when its appropriate to close the memory map.
SegmentsMemoryMap0
SegmentsACCESS_MODE0
Segmentsopen0
open(Class, path)
Open the file at the given path in read-only mode and create a Segments providing a mmap.mmap interface to the contents.
Segments__init__0
__init__(self, memory)
Initialize an instance using the given memory. An instance created by mmap.mmap.
Segments__init__Parameters
Segments__del__0
__del__(self)
If no weak references are open, close the memory map. Otherwise, add finalize each view such that the memory map is closed when the last reference is released.
Segments_decrement0
_decrement(self)
Used internally by __del__ to manage the deallocation process when there are outstanding references to the memory mapped region.
Segmentsselect192%
select(self, start, stop, size)
Constructs an iterator to the parameterized range over the memory the Segments instance was initialized with.
Segments__iter__20%
__iter__(self)
Return an iterator to the entire region in sixteen kilobyte sizes.