gnutls\_global\_set\_mem\_functions(3) gnutls gnutls\_global\_set\_mem\_functions(3)

# [NAME](#NAME)

gnutls\_global\_set\_mem\_functions - API function

# [SYNOPSIS](#SYNOPSIS)

**#include &lt;gnutls/compat.h&gt;**

**void gnutls\_global\_set\_mem\_functions(gnutls\_alloc\_function alloc\_func, gnutls\_alloc\_function secure\_alloc\_func, gnutls\_is\_secure\_function is\_secure\_func, gnutls\_realloc\_function realloc\_func, gnutls\_free\_function free\_func);**

# [ARGUMENTS](#ARGUMENTS)

[gnutls\_alloc\_function alloc\_func](#gnutls_alloc_function)

it's the default memory allocation function. Like **malloc()**.

[gnutls\_alloc\_function secure\_alloc\_func](#gnutls_alloc_function~2)

This is the memory allocation function that will be used for sensitive data.

[gnutls\_is\_secure\_function is\_secure\_func](#gnutls_is_secure_function)

a function that returns 0 if the memory given is not secure. May be NULL.

[gnutls\_realloc\_function realloc\_func](#gnutls_realloc_function)

A realloc function

[gnutls\_free\_function free\_func](#gnutls_free_function)

The function that frees allocated data. Must accept a NULL pointer.

# [DEPRECATED](#DEPRECATED)

since 3.3.0 it is no longer possible to replace the internally used memory allocation functions

This is the function where you set the memory allocation functions gnutls is going to use. By default the libc's allocation functions (**malloc()**, **free()**), are used by gnutls, to allocate both sensitive and not sensitive data. This function is provided to set the memory allocation functions to something other than the defaults

This function must be called before **gnutls\_global\_init()** is called. This function is not thread safe.

# [REPORTING BUGS](#REPORTING_BUGS)

Report bugs to &lt;bugs@gnutls.org&gt;.  
Home page: https://www.gnutls.org

# [COPYRIGHT](#COPYRIGHT)

Copyright © 2001-2023 Free Software Foundation, Inc., and others.  
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.

# [SEE ALSO](#SEE_ALSO)

The full documentation for **gnutls** is maintained as a Texinfo manual. If the /usr/share/doc/gnutls/ directory does not contain the HTML form visit

[https://www.gnutls.org/manual/](https://www.gnutls.org/manual/)

3.8.13 gnutls

---

Document: gnutls_global_set_mem_functions(3) from gnutls 3.8.13-r1 (Chainguard OS)
Source: https://gitlab.com/gnutls/gnutls
