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

Method _malloc

Lib/multiprocessing/heap.py:188–203  ·  view source on GitHub ↗
(self, size)

Source from the content-addressed store, hash-verified

186 self._lengths.remove(length)
187
188 def _malloc(self, size):
189 # returns a large enough block -- it might be much larger
190 i = bisect.bisect_left(self._lengths, size)
191 if i == len(self._lengths):
192 return self._new_arena(size)
193 else:
194 length = self._lengths[i]
195 seq = self._len_to_seq[length]
196 block = seq.pop()
197 if not seq:
198 del self._len_to_seq[length], self._lengths[i]
199
200 (arena, start, stop) = block
201 del self._start_to_block[(arena, start)]
202 del self._stop_to_block[(arena, stop)]
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

Callers 1

mallocMethod · 0.95

Calls 2

_new_arenaMethod · 0.95
popMethod · 0.45

Tested by

no test coverage detected