memory3458%python.module
fault.system

Memory management classes for implementing usage constraints in parts of processes.

os
import

weakref0
import

collections0
import

Memory266%
class

bytearray subclass supporting weak-references and identifier hashing for memory-free signalling.

Memory__slots__0
data

__slots__ = ('__weakref__',)

Memory__hash__20%
method

__hash__(self)

Object Identifier based hash for allowing indexing of allocated instances.

MemoryContext0
class

Memory pool that uses weakref's and context managers to reclaim memory.

MemoryContextMemory0
data

Memory = Memory # bytearray subclass with weakref support

MemoryContextReference0
data

Reference = weakref.ref # for reclaiming memory
	@classmethod

MemoryContextfrom_mib40%
classmethod

from_mib(typ, size)

Construct a Reservoir from the given number of Mebibytes desired.

MemoryContext__init__70%
method

__init__(self)

MemoryContextused20%
property

Memory units currently in use.

MemoryContextavailable20%
property

Number of memory units available.

MemoryContextallocate60%
method

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%
method

reclaim(self, memory)

MemoryContextacquire20%
method

acquire(self, event)

Explicitly add an object to the available segments.

Segments0
class

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
import

SegmentsACCESS_MODE0
import

Segmentsopen0
classmethod

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
method

__init__(self, memory)

Initialize an instance using the given memory. An instance created by mmap.mmap.

Segments__init__Parameters

self

Undocumented.

memory

The mmap.mmap instance defining the total memory region.

Segments__del__0
method

__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
method

_decrement(self)

Used internally by __del__ to manage the deallocation process when there are outstanding references to the memory mapped region.

Segmentsselect192%
method

select(self, start, stop, size)

Constructs an iterator to the parameterized range over the memory the Segments instance was initialized with.

Segments__iter__20%
method

__iter__(self)

Return an iterator to the entire region in sixteen kilobyte sizes.