bpo-32759: Free unused arenas in multiprocessing.heap by pitrou · Pull Request #5827 · python/cpython

@pitrou

@pitrou

Large shared arrays allocated using multiprocessing would remain allocated
until the process ends.

serhiy-storchaka

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started reviewing yesterday, but it will take some time to grok this code.

if new_stop < stop:
self._free((arena, new_stop, stop))
self._add_free_block((arena, new_stop, stop))
block = (arena, start, new_stop)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The block variable can be inlined now.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed :-)

@pitrou

but it will take some time to grok this code.

Yes, it's a mini-memory allocator here. Not too complex fortunately.

@pitrou

@pitrou

@pitrou

I adressed the review comment and added some comments to try and explain the allocator a bit more.

If there are no further review comments, I will merge this PR.

serhiy-storchaka

@pitrou

@pitrou pitrou deleted the mp_heap_arena_free branch

April 9, 2018 15:37