Skip to content
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

Memory allocation #118

Closed
bullitmaster opened this issue Oct 8, 2020 · 3 comments · Fixed by #119 or microsoft/vcpkg#25879
Closed

Memory allocation #118

bullitmaster opened this issue Oct 8, 2020 · 3 comments · Fixed by #119 or microsoft/vcpkg#25879

Comments

@bullitmaster
Copy link

For embedded systems it is convenient to use a custom memory allocator.

Thanks for the project!

Best Regards,
Aleksandr (aka bullit master)

@benhoyt
Copy link
Owner

benhoyt commented Oct 8, 2020

I would have thought for embedded system using stack allocation (-DINI_USE_STACK=0) instead of dynamic memory allocation at all would be better.

But in any case, I'd consider making malloc/realloc/free overridable. What do you think is the best way to do this? What about just calling INI_MALLOC(...) etc, and then defining them like this in ini.h (for each of malloc, realloc, and free):

#ifndef INI_MALLOC
#define INI_MALLOC malloc
#endif

@bullitmaster
Copy link
Author

It's a good idea!

Thans!

@benhoyt
Copy link
Owner

benhoyt commented Oct 11, 2020

I've done it slightly differently than I suggested (to avoid forward-reference issues). But take a look at #119 and see if that looks good. Any code review comments welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants