File tree 2 files changed +12
-6
lines changed 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -206,12 +206,17 @@ The :mod:`gc` module provides the following functions:
206
206
207
207
.. function :: freeze()
208
208
209
- Freeze all the objects tracked by gc - move them to a permanent generation
210
- and ignore all the future collections. This can be used before a POSIX
211
- fork() call to make the gc copy-on-write friendly or to speed up collection.
212
- Also collection before a POSIX fork() call may free pages for future
213
- allocation which can cause copy-on-write too so it's advised to disable gc
214
- in parent process and freeze before fork and enable gc in child process.
209
+ Freeze all the objects tracked by the garbage collector; move them to a
210
+ permanent generation and ignore them in all the future collections.
211
+
212
+ If a process will ``fork() `` without ``exec() ``, avoiding unnecessary
213
+ copy-on-write in child processes will maximize memory sharing and reduce
214
+ overall memory usage. This requires both avoiding creation of freed "holes"
215
+ in memory pages in the parent process and ensuring that GC collections in
216
+ child processes won't touch the ``gc_refs `` counter of long-lived objects
217
+ originating in the parent process. To accomplish both, call ``gc.disable() ``
218
+ early in the parent process, ``gc.freeze() `` right before ``fork() ``, and
219
+ ``gc.enable() `` early in child processes.
215
220
216
221
.. versionadded :: 3.7
217
222
Original file line number Diff line number Diff line change @@ -1115,6 +1115,7 @@ Jason Lowe
1115
1115
Tony Lownds
1116
1116
Ray Loyzaga
1117
1117
Kang-Hao (Kenny) Lu
1118
+ Raymond Lu
1118
1119
Lukas Lueg
1119
1120
Loren Luke
1120
1121
Fredrik Lundh
You can’t perform that action at this time.
0 commit comments