SDL Wiki
(This is the documentation for SDL3, which is the current stable version. SDL2 was the previous version!)

SDL_realloc

Change the size of allocated memory.

Header File

Defined in <SDL3/SDL_stdinc.h>

Syntax

void * SDL_realloc(void *mem, size_t size);

Function Parameters

void * mem a pointer to allocated memory to reallocate, or NULL.
size_t size the new size of the memory.

Return Value

(void *) Returns a pointer to the newly allocated memory, or NULL if allocation failed.

Remarks

The memory returned by this function must be freed with SDL_free().

If size is 0, it will be set to 1. Note that this is unlike some other C runtime realloc implementations, which may treat realloc(mem, 0) the same way as free(mem).

If mem is NULL, the behavior of this function is equivalent to SDL_malloc(). Otherwise, the function can have one of three possible outcomes:

Thread Safety

It is safe to call this function from any thread.

Version

This function is available since SDL 3.1.3.

See Also


CategoryAPI, CategoryAPIFunction, CategoryStdinc


[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.