1= nng_free(3)
2//
3// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
4// Copyright 2018 Capitar IT Group BV <info@capitar.com>
5//
6// This document is supplied under the terms of the MIT License, a
7// copy of which should be located in the distribution where this
8// file was obtained (LICENSE.txt).  A copy of the license may also be
9// found online at https://opensource.org/licenses/MIT.
10//
11
12== NAME
13
14nng_free - free memory
15
16== SYNOPSIS
17
18[source, c]
19----
20#include <nng/nng.h>
21
22void nng_free(void *ptr, size_t size);
23----
24
25== DESCRIPTION
26
27The `nng_free()` function deallocates a memory region of size _size_,
28that was previously allocated by xref:nng_alloc.3.adoc[`nng_alloc()`] or
29xref:nng_recv.3.adoc[`nng_recv()`] with the `NNG_FLAG_ALLOC` flag.
30
31IMPORTANT: It is very important that _size_ match the allocation size
32used to allocate the memory.
33
34IMPORTANT: Do not attempt to use this function to deallocate memory
35obtained by a call to the system `malloc()` or `calloc()` functions,
36or the {cpp} `new` operator.
37Doing so may result in unpredictable
38behavior, including corruption of application memory.
39
40== RETURN VALUES
41
42None.
43
44== ERRORS
45
46None.
47
48== SEE ALSO
49
50[.text-left]
51xref:nng_alloc.3.adoc[nng_alloc(3)],
52xref:nng_recv.3.adoc[nng_recv(3)],
53xref:nng.7.adoc[nng(7)]
54