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

Method _add_free_block

Lib/multiprocessing/heap.py:205–233  ·  view source on GitHub ↗
(self, block)

Source from the content-addressed store, hash-verified

203 return block
204
205 def _add_free_block(self, block):
206 # make block available and try to merge with its neighbours in the arena
207 (arena, start, stop) = block
208
209 try:
210 prev_block = self._stop_to_block[(arena, start)]
211 except KeyError:
212 pass
213 else:
214 start, _ = self._absorb(prev_block)
215
216 try:
217 next_block = self._start_to_block[(arena, stop)]
218 except KeyError:
219 pass
220 else:
221 _, stop = self._absorb(next_block)
222
223 block = (arena, start, stop)
224 length = stop - start
225
226 try:
227 self._len_to_seq[length].append(block)
228 except KeyError:
229 self._len_to_seq[length] = [block]
230 bisect.insort(self._lengths, length)
231
232 self._start_to_block[(arena, start)] = block
233 self._stop_to_block[(arena, stop)] = block
234
235 def _absorb(self, block):
236 # deregister this block so it can be merged with a neighbour

Callers 3

_free_pending_blocksMethod · 0.95
freeMethod · 0.95
mallocMethod · 0.95

Calls 2

_absorbMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected