## nng_msg_alloc Allocate a message. ### Synopsis ```c #include int nng_msg_alloc(nng_msg **msgp, size_t size); ``` ### Description The `nng_msg_alloc` function allocates a new message with body length _size_ and stores the result in __msgp__. Messages allocated with this function contain a body and optionally a header. They are used with receive and transmit functions. ### Return Values This function returns 0 on success, and non-zero otherwise. ### Errors [horizontal] `NNG_ENOMEM`:: Insufficient free memory exists to allocate a message. ### See Also xref:nng_msg_free.adoc[nng_msg_free], xref:nng_msg_body.adoc[nng_msg_body], xref:nng_msg_dup.adoc[nng_msg_dup], xref:nng_msg_header.adoc[nng_msg_header], xref:nng_msg_header_len.adoc[nng_msg_header_len], xref:nng_msg_len.adoc[nng_msg_len], xref:nng_msg_capacity.adoc[nng_msg_capacity], xref:nng_msg_reserve.adoc[nng_msg_reserve], xref:nng_msg_realloc.adoc[nng_msg_realloc],