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

Supplying custom allocation/deallocation routines #372

Open
ningvin opened this issue Oct 11, 2023 · 2 comments
Open

Supplying custom allocation/deallocation routines #372

ningvin opened this issue Oct 11, 2023 · 2 comments

Comments

@ningvin
Copy link

ningvin commented Oct 11, 2023

I am usually working in an environment where custom allocators are used for various reasons and usage of plain malloc/free is frowned upon. Thankfully many libraries allow their users to supply custom (de)allocation routines.

While support for this can be as simple as some defines that default to malloc/free, I always found that in practice it is way more convenient to be able to pass some user data (often just a void*) to the (de)allocation routines (similar to what is suggested in #356). See for example PCRE2 that does this upon context creation (e.g. pcre2_general_context_create).

If you feel that this would fit MIR and is worth pursuing, I could try to put together a pull request for this :-)

@vnmakarov
Copy link
Owner

Sorry for long delay with the answer, I overlooked your message. I think custom allocation would be useful for some applications. So it is worth to pursue this. I only have one important requirement is to save somehow the old library interface for compatibility.

@ningvin
Copy link
Author

ningvin commented Nov 24, 2023

Thanks for your feedback :-)
I am currently a bit busy with some other stuff, so it might be a while until I have something to show.
Just to clarify: by library interface you mean the functions/types in mir.h and mir-gen.h and the like, but not e.g. mir-htab.h and mir-varr.h, correct?

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

No branches or pull requests

2 participants