From: Mathieu Othacehe <othacehe@gnu.org>
To: zimoun <zimon.toutoune@gmail.com>
Cc: 46796@debbugs.gnu.org
Subject: bug#46796: Cuirass & pointer finalization.
Date: Sat, 27 Feb 2021 13:59:50 +0100 [thread overview]
Message-ID: <87blc5vf7d.fsf@gnu.org> (raw)
In-Reply-To: <86im6e1tbr.fsf@gmail.com> (zimoun's message of "Fri, 26 Feb 2021 21:12:56 +0100")
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
next prev parent reply other threads:[~2021-02-27 13:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-26 14:14 bug#46796: Cuirass & pointer finalization Mathieu Othacehe
2021-02-26 20:12 ` zimoun
2021-02-27 12:59 ` Mathieu Othacehe [this message]
2021-02-27 12:50 ` Mathieu Othacehe
2021-03-01 9:37 ` Ludovic Courtès
2021-03-02 8:08 ` Mathieu Othacehe
2021-03-02 13:50 ` Ludovic Courtès
2021-03-02 17:02 ` Mathieu Othacehe
2021-03-08 13:45 ` Ludovic Courtès
2023-11-23 11:39 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87blc5vf7d.fsf@gnu.org \
--to=othacehe@gnu.org \
--cc=46796@debbugs.gnu.org \
--cc=zimon.toutoune@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).