---
name: "gnutls_global_set_mem_functions"
section: "3"
platform: "linux"
package: "gnutls"
version: "3.8.13-3"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/gnutls_global_set_mem_functions"
---

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

API function

## NAME

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

## SYNOPSIS

**#include \<gnutls/compat.h\>**

**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

- gnutls\_alloc\_function alloc\_func

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

- gnutls\_alloc\_function secure\_alloc\_func

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

- gnutls\_is\_secure\_function is\_secure\_func

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

- gnutls\_realloc\_function realloc\_func

  A realloc function

- gnutls\_free\_function free\_func

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

## 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

Report bugs to \<bugs@gnutls.org\>.\
 Home page: https://www.gnutls.org

## 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

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/
