logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

SDL_SetMemoryFunctions - Replace SDL's memory allocation functions with a custom set.

Availability

       This function is available since SDL 3.2.0.

Description

       It  is  not  safe  to call this function once any allocations have been made, as future calls to SDL_free
       will use the new allocator, even if they came from an SDL_malloc made with the old one!

       If used, usually this needs to be the first call made into the SDL library, if not the very  first  thing
       done at program startup time.

Function Parameters

malloc_func
              custom malloc function.

       calloc_func
              custom calloc function.

       realloc_func
              custom realloc function.

       free_func
              custom free function.

Name

       SDL_SetMemoryFunctions - Replace SDL's memory allocation functions with a custom set.

Return Value

       for more information.

See Also

SDL_GetMemoryFunctions(3), SDL_GetOriginalMemoryFunctions(3)

Simple Directmedia Layer                           SDL 3.2.20                          SDL_SetMemoryFunctions(3)

Synopsis

#include<SDL3/SDL_stdinc.h>boolSDL_SetMemoryFunctions(SDL_malloc_funcmalloc_func,SDL_calloc_funccalloc_func,SDL_realloc_funcrealloc_func,SDL_free_funcfree_func);

Thread Safety

       It  is  safe  to call this function from any thread, but one should not replace the memory functions once
       any allocations are made!

return

See Also