[nanomsg] Re: why memcpy data to be sent?

  • From: Martin Sustrik <sustrik@xxxxxxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Mon, 27 Oct 2014 09:40:51 +0100

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Steve,

> Someone asked this in the #nanomsg channel: why is data to be sent 
> copied first?
> 
> https://github.com/nanomsg/nanomsg/blob/master/src/core/global.c#L739-L747

There's
> 
no guarantee that the supplied scatter array will not be
deallocated by the user while still being used. Therefore nanomsg
makes its own private copy where it can control its lifetime.

Martin

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQEcBAEBAgAGBQJUTgUTAAoJENTpVjxCNN9Y3qoH/0kcq0UJQc+zpNDyepXucev0
3Shl8WS5nZEsYWe3epks2e+2VF04s9x1OJtN+MDThf0WDkjJPUifkegADNFJDZPM
UiGZYway3rGBtNiT+G9qyscRbo4DINsGfPE1dNl93Do7fyTHYn2Iu8xj5mDi3eBK
4HVKkFecdZC5cKXfF0t9K28G5b9CFFqR71M00qHV0+xfTigqax3/A5qKs9m2kFOA
z9nSm7p8drUKiizCl2B/dHVLtXJpXa+RBZ0EMaCgHdjoBJmqBKtl362Lo5DguCb0
0b5enTFSecDfEQYYAccR+cvmaGTE9U+LiPEPsXgL9kSrlox4UFB108itwjpDZvE=
=8/sv
-----END PGP SIGNATURE-----

Other related posts: