add yp_alloc to begin creating our own allocator#1375
Closed
add yp_alloc to begin creating our own allocator#1375
Conversation
51a78a2 to
5dc32ac
Compare
5dc32ac to
95dc4ef
Compare
This was referenced Sep 5, 2023
f8dfc34 to
068c475
Compare
kddnewton
requested changes
Sep 6, 2023
Collaborator
kddnewton
left a comment
There was a problem hiding this comment.
In general this looks good, but before we merge I'd like to see the functions in yp_alloc.c marked as static that shouldn't be visible to other translation units. Also, we definitely need some comments on all of the functions that are visible beyond yp_alloc.h.
I'm not entirely clear on the USE_ARENA macro. It looks like it's triggering behavior, but it's always set to 1. Is this meant as a migration path? If so I would think it should be set to 0.
068c475 to
6dccb25
Compare
6dccb25 to
d65527a
Compare
Collaborator
Author
|
Thanks @kddnewton I incorporated your feedback. I removed the USE_ARENA macro, was there to make comparing performance easier, but that doesn't need to be here now, so I removed it. How does this look now? |
Collaborator
Author
|
Closing while we discuss direction to reopen later. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This introduces
yp_mallocyp_callocandyp_freeas allocation APIs which we can use to manage allocations.Once these are centralized we can use xmalloc if in a Ruby context and/or use an arena allocator to reduce syscalls to malloc.
Related to this issue: #1337
This is a small part of my working arena allocator here: https://github.com/HParker/yarp/tree/introduce-yp_malloc
In an effort to make smaller changes at a time, this only updates direct malloc/calloc/free calls in yarp.c. There are more allocations that I will move in followup PRs.