table of contents
SDL_realloc(3) | SDL3 FUNCTIONS | SDL_realloc(3) |
NAME¶
SDL_realloc - Change the size of allocated memory.
HEADER FILE¶
Defined in SDL3/SDL_stdinc.h
SYNOPSIS¶
#include "SDL3/SDL.h"
void * SDL_realloc(void *mem, size_t size);
DESCRIPTION¶
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:
• If it returns the same pointer as mem , it means
that mem was resized
in place without freeing.
• If it returns a different non-NULL pointer, it means that
mem was freed
and cannot be dereferenced anymore.
• If it returns NULL (indicating failure), then mem
will remain valid and
must still be freed with SDL_free ().
FUNCTION PARAMETERS¶
RETURN VALUE¶
Returns a pointer to the newly allocated memory, or NULL if allocation failed.
THREAD SAFETY¶
It is safe to call this function from any thread.
AVAILABILITY¶
This function is available since SDL 3.1.3.
SEE ALSO¶
•(3), SDL_free(3), •(3), SDL_malloc(3), •(3), SDL_calloc(3)
SDL 3.1.6 | Simple Directmedia Layer |