mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-26 02:18:06 +01:00
Problem: enormous memory increase due to zero copy decoding
The zero copy decoding strategy implemented for 4.2.0 can lead to a large increase of main memory usage in some cases (I have seen one program go up to 40G from 10G after upgrading from 4.1.4). This commit adds a new option to contexts, called ZMQ_ZERO_COPY_RECV, which allows one to switch to the old decoding strategy.
This commit is contained in:
@@ -636,15 +636,15 @@ bool zmq::stream_engine_t::handshake ()
|
||||
encoder = new (std::nothrow) v2_encoder_t (out_batch_size);
|
||||
alloc_assert (encoder);
|
||||
|
||||
decoder =
|
||||
new (std::nothrow) v2_decoder_t (in_batch_size, options.maxmsgsize);
|
||||
decoder = new (std::nothrow)
|
||||
v2_decoder_t (in_batch_size, options.maxmsgsize, options.zero_copy);
|
||||
alloc_assert (decoder);
|
||||
} else {
|
||||
encoder = new (std::nothrow) v2_encoder_t (out_batch_size);
|
||||
alloc_assert (encoder);
|
||||
|
||||
decoder =
|
||||
new (std::nothrow) v2_decoder_t (in_batch_size, options.maxmsgsize);
|
||||
decoder = new (std::nothrow)
|
||||
v2_decoder_t (in_batch_size, options.maxmsgsize, options.zero_copy);
|
||||
alloc_assert (decoder);
|
||||
|
||||
if (options.mechanism == ZMQ_NULL
|
||||
|
||||
Reference in New Issue
Block a user