---
name: "SDL_ALLOC_SIZE"
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_ALLOC_SIZE"
---

# SDL\_ALLOC\_SIZE(3)

A macro to tag a function as returning a certain allocation.

## NAME

SDL\_ALLOC\_SIZE - A macro to tag a function as returning a certain allocation.

## HEADER FILE

Defined in SDL3/SDL\_begin\_code.h

## SYNOPSIS

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

**#define SDL\_ALLOC\_SIZE(p) \_\_attribute\_\_((alloc\_size(p)))**

## DESCRIPTION

This is a hint to the compiler that a function allocates and returns a specific amount of memory based on one of its arguments. For example, the C runtime's malloc() function could use this macro with an argument of 1 (first argument to malloc is the size of the allocation).

On compilers without alloc\_size 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.
