advance refcnt only if it was used

This commit is contained in:
KIU Shueng Chuan
2015-07-22 21:19:22 +08:00
parent c05a475bf7
commit 708353a1b9
3 changed files with 11 additions and 4 deletions

View File

@@ -129,11 +129,12 @@ int zmq::v2_decoder_t::size_ready(uint64_t msg_size, unsigned char const* read_p
// if the message will be a large message, pass a valid refcnt memory location as well
rc = in_progress.init( (unsigned char*)read_pos, msg_size,
shared_message_memory_allocator::call_dec_ref, buffer(),
create_refcnt() );
provide_refcnt() );
// For small messages, data has been copied and refcount does not have to be increased
if (in_progress.is_zcmsg())
{
advance_refcnt();
inc_ref();
}
}