MCPcopy Index your code
hub / github.com/python/cpython / __init__

Method __init__

Lib/multiprocessing/heap.py:123–150  ·  view source on GitHub ↗
(self, size=mmap.PAGESIZE)

Source from the content-addressed store, hash-verified

121 _DOUBLE_ARENA_SIZE_UNTIL = 4 * 1024 ** 2
122
123 def __init__(self, size=mmap.PAGESIZE):
124 self._lastpid = os.getpid()
125 self._lock = threading.Lock()
126 # Current arena allocation size
127 self._size = size
128 # A sorted list of available block sizes in arenas
129 self._lengths = []
130
131 # Free block management:
132 # - map each block size to a list of `(Arena, start, stop)` blocks
133 self._len_to_seq = {}
134 # - map `(Arena, start)` tuple to the `(Arena, start, stop)` block
135 # starting at that offset
136 self._start_to_block = {}
137 # - map `(Arena, stop)` tuple to the `(Arena, start, stop)` block
138 # ending at that offset
139 self._stop_to_block = {}
140
141 # Map arenas to their `(Arena, start, stop)` blocks in use
142 self._allocated_blocks = defaultdict(set)
143 self._arenas = []
144
145 # List of pending blocks to free - see comment in free() below
146 self._pending_free_blocks = []
147
148 # Statistics
149 self._n_mallocs = 0
150 self._n_frees = 0
151
152 @staticmethod
153 def _roundup(n, alignment):

Callers 1

mallocMethod · 0.95

Calls 2

defaultdictClass · 0.85
LockMethod · 0.80

Tested by

no test coverage detected