summaryrefslogtreecommitdiff
path: root/docs/reference/src/util/nng_free.md
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2024-03-30 16:12:02 -0700
committerGarrett D'Amore <garrett@damore.org>2024-03-30 16:12:02 -0700
commitb779b71b00c5f5f8cb9f0ee7d8feeadf9e2dca48 (patch)
treea4f70586954a32d8c2fef36c46aa601ee874606e /docs/reference/src/util/nng_free.md
parenta622720b87cbee884c07feac228796415d4cb548 (diff)
downloadnng-b779b71b00c5f5f8cb9f0ee7d8feeadf9e2dca48.tar.gz
nng-b779b71b00c5f5f8cb9f0ee7d8feeadf9e2dca48.tar.bz2
nng-b779b71b00c5f5f8cb9f0ee7d8feeadf9e2dca48.zip
util funcs reorg
Diffstat (limited to 'docs/reference/src/util/nng_free.md')
-rw-r--r--docs/reference/src/util/nng_free.md37
1 files changed, 37 insertions, 0 deletions
diff --git a/docs/reference/src/util/nng_free.md b/docs/reference/src/util/nng_free.md
new file mode 100644
index 00000000..e93e91e6
--- /dev/null
+++ b/docs/reference/src/util/nng_free.md
@@ -0,0 +1,37 @@
+# nng_free
+
+## NAME
+
+nng_free --- free memory
+
+## SYNOPSIS
+
+```c
+#include <nng/nng.h>
+
+void nng_free(void *ptr, size_t size);
+```
+
+## DESCRIPTION
+
+The `nng_free()` function deallocates a memory region of size _size_,
+that was previously allocated by [`nng_alloc()`][nng_alloc] or
+[`nng_recv()`](../socket/nng_recv.md) with the `NNG_FLAG_ALLOC` flag.
+
+> [!IMPORTANT]
+> It is very important that _size_ match the allocation size
+> used to allocate the memory.
+
+> [!IMPORTANT]
+> Do not attempt to use this function to deallocate memory
+> obtained by a call to the system `malloc()` or `calloc()` functions,
+> or the C++ `new` operator.
+> Doing so may result in unpredictable
+> behavior, including corruption of application memory.
+
+## SEE ALSO
+
+[nng_alloc][nng_alloc],
+[nng_recv](../socket/nng_recv.md)
+
+{{#include ../refs.md}}