[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#46796: Cuirass & pointer finalization.
From: |
Mathieu Othacehe |
Subject: |
bug#46796: Cuirass & pointer finalization. |
Date: |
Sat, 27 Feb 2021 13:59:50 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Hello zimoun,
> and why is ’zmq-message-content’ used for? Since ’message’ is
> initialized with zero, I guess. Well, I am confused by:
>
> (let ((content-ptr (zmq_msg_data (message->pointer message)))
> [...]
> (pointer->bytevector content-ptr size))))
>
> …
>
> (let ((msg (pointer->message! msg-pointer)))
> (when content-bv
> (let ((target (zmq-message-content msg)))
> (bytevector-copy! content-bv 0 target 0 len)))
> msg))))
>
> Is ’target’ at the same address than ’msg’? Maybe ’target’ creates
> somehow a dangling pointer.
No 'target' is not at the same address than 'msg', it's just a field of
'msg' that is allocated internally when "zmq_msg_init_size" is called.
Allocating a message with "zmq_msg_init_size" and filling its content by
memcpy'ing data to the memory region pointed by "zmq_msg_data" is the
example given in "Man 3 zmq_msg_send", to I hope this is a valid
use-case :).
Thanks,
Mathieu