---
name: "SDL_MALLOC"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_MALLOC"
---

# SDL\_MALLOC(3)

A macro to tag a function as an allocator.

## NAME

SDL\_MALLOC - A macro to tag a function as an allocator.

## HEADER FILE

Defined in SDL3/SDL\_begin\_code.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**#define SDL\_MALLOC \_\_declspec(allocator) \_\_desclspec(restrict)**

## DESCRIPTION

This is a hint to the compiler that a function is an allocator, like malloc(), with certain rules. A description of how GCC treats this hint is here:

https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-malloc-function-attribute

On compilers without allocator tag support, this is defined to nothing.

Most apps don't need to, and should not, use this directly.

## AVAILABILITY

This macro is available since SDL 3.2.0.
