[issue31558] gc.freeze() - an API to mark objects as uncollectable

Zekun Li report at bugs.python.org
Wed Oct 11 15:40:28 EDT 2017


Zekun Li <li.zekun at gmail.com> added the comment:

> This is only useful if the parent process has a lot of memory that's never used by the child processes right? Otherwise, you would lose via refcounting COWs.

What we saw in prod is that memory fragmentation caused by gc is the main reason of shared memory shrink.

The memory fragmentation is figured out by doing a full collection before fork and keep it disabled, it'll make a bunch of copy-on-write in child process.

This can't solve the copy-on-write caused by ref count, but we're thinking about freezing the ref count on those permanent objects too.

So this is useful if you did some warm-up work in parent process.

Also it could speedup gc if you have large amount of permanent objects.

----------
nosy: +brainfvck

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31558>
_______________________________________


More information about the Python-bugs-list mailing list