SIGN IN SIGN UP
python / cpython UNCLAIMED

The Python programming language

0 0 189 Python

bpo-31993: Do not allocate large temporary buffers in pickle dump. (#4353)

The picklers do no longer allocate temporary memory when dumping large
bytes and str objects into a file object. Instead the data is
directly streamed into the underlying file object.

Previously the C implementation would buffer all content and issue a
single call to file.write() at the end of the dump. With protocol 4
this behavior has changed to issue one call to file.write() per frame.

The Python pickler with protocol 4 now dumps each frame content as a
memoryview to an IOBytes instance that is never reused and the
memoryview is no longer released after the call to write. This makes it
possible for the file object to delay access to the memoryview of
previous frames without forcing any additional memory copy as was
already possible with the C pickler.
O
Olivier Grisel committed
3cd7c6e6eb43dbd7d7180503265772a67953e682
Parent: 85ac726
Committed by Serhiy Storchaka <storchaka@gmail.com> on 1/6/2018, 3:18:54 PM