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

Zekun Li report at bugs.python.org
Wed Oct 11 21:41:33 EDT 2017


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

So what we did is:

We keep gc **disabled** on parent process and freeze after warmup, enable gc on child process.

The reason not to do a full collection is mentioned in previous comments/original ticket - (I called it) memory fragmentation.

The observation is - We keep gc disabled on both parent and child process and did a full collection before fork, it makes the shared memory shrink a lot compared to no collection. - There's no way for disabled gc to touch the head to make copy-on-write.

Of course, enable gc will make the shared memory shrink more. But the former case is accounting more than latter one.

So my understand is that gc frees some objects and makes some memory pages becomes available to allocate in child process. Allocation on the shared memory pages will cause the copy-on-write even without gc.

Though this behavior may have better name?

----------

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


More information about the Python-bugs-list mailing list