You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Raylib has a support for providing custom heap memory allocators by defining RL_MALLOC / RL_CALLOC / RL_REALLOC / RL_FREE macros. GLFW supports this too, but with function pointers passed into glfwInitAllocator() call. Currently, raylib does not use glfwInitAllocator anywhere, and so GLFW always uses default LibC allocators, which is undesired.
I noticed that there is some code in src/platforms/rcore_desktop_glfw.c that was meant to support this, but it is currently commented-out with a TODO note:
Raylib allows for providing custom allocators via macros.
GLFW supports this too, but via function pointers.
Make sure that GLFW uses those Raylib macros, by wrapping them in
function calls and setting them up inside of InitPlatform().
This is possible because of glfwInitAllocator() and GLFWallocator.
Fixes: raysan5#4776
Relates-to: raysan5#4751
sleeptightAnsiC
changed the title
[rcore] GLFW does not use Raylib-provided RL_*alloc macros for memory allocations
[rcore] GLFW does not use Raylib-provided RL_*ALLOC macros for memory allocations
Feb 18, 2025
Raylib has a support for providing custom heap memory allocators by defining
RL_MALLOC
/RL_CALLOC
/RL_REALLOC
/RL_FREE
macros. GLFW supports this too, but with function pointers passed into glfwInitAllocator() call. Currently, raylib does not use glfwInitAllocator anywhere, and so GLFW always uses default LibC allocators, which is undesired.I noticed that there is some code in
src/platforms/rcore_desktop_glfw.c
that was meant to support this, but it is currently commented-out with a TODO note:raylib/src/platforms/rcore_desktop_glfw.c
Lines 1290 to 1305 in 11090ab
Related to #4751
[I'll make a PR for this in a moment]
The text was updated successfully, but these errors were encountered: