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

User-defined allocator - COROUTINE_MALLOC, COROUTINE_REALLOC, COROUTINE_FREE #8

Closed
wants to merge 2 commits into from

Conversation

kamkow1
Copy link

@kamkow1 kamkow1 commented Feb 1, 2025

Hello!
This pull request implements COROUTINE_MALLOC, COROUTINE_REALLOC, COROUTINE_FREE macros that allow the user to define their own allocator. I've also included a modified version of "counter.c" example and a simple testing allocator "myalloc.c" just to show how one can use a custom allocator with the coroutines library.
Have a nice day!

@rexim
Copy link
Member

rexim commented Feb 2, 2025

Since d4ab4a2 allocating the memory for stack requires platform dependent OS API calls with special flags to ensure optimal memory settings for the stack. So for each platform we are going to hardcode some thing specific. For the rest of the data structure allocation I think using realloc from libc is fine.

@rexim rexim closed this Feb 2, 2025
@kamkow1 kamkow1 deleted the feat/custom_alloc branch February 2, 2025 09:35
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

Successfully merging this pull request may close these issues.

None yet

2 participants