mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
bpo-35715: Liberate return value of _process_worker (GH-11514)
ProcessPoolExecutor workers will hold the return value of their last task in memory until the next task is received. Since the return value has already been propagated to the parent process's Future (or has been discarded by this point), the object can be safely released.
This commit is contained in:
parent
9c68543f02
commit
962bdeab19
2 changed files with 2 additions and 0 deletions
|
@ -235,6 +235,7 @@ def _process_worker(call_queue, result_queue, initializer, initargs):
|
|||
_sendback_result(result_queue, call_item.work_id, exception=exc)
|
||||
else:
|
||||
_sendback_result(result_queue, call_item.work_id, result=r)
|
||||
del r
|
||||
|
||||
# Liberate the resource as soon as possible, to avoid holding onto
|
||||
# open files or shared memory that is not needed anymore
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue