Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Doc/library/multiprocessing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2293,6 +2293,16 @@ with the :class:`Pool` class.
the process pool as separate tasks. The (approximate) size of these
chunks can be specified by setting *chunksize* to a positive integer.

It is important to distinguish between *maxtasksperchild* in the
:class:`Pool` class and *chunksize*. Whereas *maxtasksperchild* denotes
how many tasks can be run at once before those resources are freed,
*chunksize* defines how many separate chunks in which to split all of the
iterations of the function. In order for each iteration of the function to
be executed separately, *chunksize* needs to be set to 1.

Whereas :meth:`imap` defaults to a *chunksize* of 1, :meth:`map` defaults
to ``None`` and needs to be declared explicitly.

Note that it may cause high memory usage for very long iterables. Consider
using :meth:`imap` or :meth:`imap_unordered` with explicit *chunksize*
option for better efficiency.
Expand Down