GNU bug report logs -
#46796
Cuirass & pointer finalization.
Previous Next
Reported by: Mathieu Othacehe <othacehe <at> gnu.org>
Date: Fri, 26 Feb 2021 14:15:02 UTC
Severity: important
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
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
This bug report was last modified 1 year and 186 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.