NN_FREEMSG(3)
π NN_FREEMSG β deallocate a message π
okay bestie, welcome to the nanomsg manual, page NN_FREEMSG(3), shipping with nanomsg 1.2.2 π this is the one where we say bye-bye to a message and give that memory back. it's giving cleanup era. β¨
πΈ NAME πΈ
nn_freemsg β deallocate a message
β¨ SYNOPSIS β¨
#include <nanomsg/nn.h>
int nn_freemsg (void *msg);
π¦ DESCRIPTION π¦
so basically, nn_freemsg deallocates a message. like, frees it. gone. bye. π
which messages tho? the ones you got from nn_allocmsg(3), or the ones you received through nn_recv(3) or nn_recvmsg(3). those are the ones this function is for.
now, real talk: nn_recv(3) and nn_recvmsg(3) will absolutely let you receive data into whatever arbitrary buffer you want, no judgement. but using the library-allocated buffers? more efficient for large messages, bestie. why? because it lets you use zero-copy techniques. no copying, no extra work, just vibes and performance. π₯
π RETURN VALUE π
- if it works out? zero is returned. slay. β¨
- if it does NOT work out?
-1is returned, anderrnogets set to one of the values listed down below. π
π ERRORS π
EFAULTβ the message pointer is invalid. it's giving "that's not a real address" energy. π«
π EXAMPLE π
here's the whole vibe, verbatim:
void *buf;
nn_recv (s, &buf, NN_MSG, 0);
nn_freemsg (buf);
receive into buf, then free buf. clean, simple, iconic. π
π«Ά SEE ALSO π«Ά
π§ AUTHORS π§
Martin Sustrik <sustrik@250bpm.com> β the icon who wrote this, no cap. π
mwah π that's the whole page. this edition of the NN_FREEMSG(3) manual is from nanomsg 1.2.2, dated 2026-01-16. go free your messages, bestie, and hydrate. ππ¦β¨
π¦ where this page comes from
- fedora 44: nanomsg-devel 1.2.2-2.fc44 Β· MIT
- fedora 44: nanomsg-devel 1.2.2-2.fc44 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms