zeromq / jzmq

Java binding for ZeroMQ
http://www.zeromq.org
GNU General Public License v3.0
589 stars 363 forks source link

JZMQ send/recv zero copy API not actually a zero copy #189

Open trevorbernard opened 11 years ago

trevorbernard commented 11 years ago

https://github.com/zeromq/jzmq/blob/v2.1.2/src/Socket.cpp#L484 https://github.com/zeromq/libzmq/blob/master/src/zmq.cpp#L364

https://github.com/zeromq/jzmq/blob/v2.1.2/src/Socket.cpp#L587 https://github.com/zeromq/libzmq/blob/master/src/zmq.cpp#L460

See http://api.zeromq.org/3-2:zmq-msg-init-data for true zero copy

hintjens commented 11 years ago

The zmq_send and zmq_recv functions were added during the 3.x development to provide a simpler API and they do not do zero copy, ever. You need to use the older lower-level zmq_msg_send and zmq_msg_recv functions, and on sending, the zmq_msg_init_data function to pass the application buffer.