-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support custom malloc()/free() for memory allocation #98
Comments
Take a look at the contents of |
@LxLasso thanks for the answer! Yes, that's an option for custom allocators but calling |
I see @raysan5 . In that case there's an include for |
@LxLasso actually, there are also a couple of calls to
Using a macro like the one I mention and replacing #ifndef CGLTF_MALLOC
#define CGLTF_MALLOC(sz) malloc(sz)
#define CGLTF_FREE(p) free(p)
#endif Users can just define the macro in their code: #define CGLTF_MALLOC(sz) custom_malloc(sz)
#define CGLTF_FREE(p) custom_free(p)
#define CGLTF_IMPLEMENTATION
#include "cgltf.h" // malloc()/free() symbols never defined, stdlib not required |
So, do I get this right, your goal is to get rid of the stdlib dependency? |
@jkuhlmann Actually the goal is having a mechanism to not only allow custom allocator but also avoid system dependencies to default ones. It's just to increase a bit library portability. Here it is my related issue: raysan5/raylib#1074 |
@jkuhlmann that's perfect! thank you very much for implementing it! 👍😄 |
Similar to stb libraries, it would be nice to support custom memory allocators:
The text was updated successfully, but these errors were encountered: