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

Improve realloc on fixed buffer allocator #1238

Conversation

BarabasGitHub
Copy link
Contributor

I was looking through the code and figured this would be useful.

The FixedBufferAllocator now checks if the memory buffer you pass into realloc is at the end of the used memory and just extends it instead of always allocating a new block.

@andrewrk
Copy link
Member

Related: #382

It would be great if we could get comptime code execution to support this with no modifications to your implementation. Maybe at comptime we could model pointers like this as opaque values but that are comparable, or something like that.

Now that I'm thinking about it, I think I could get it to work in a reasonable way without too much code reworking.

@andrewrk andrewrk merged commit 69e50ad into ziglang:master Jul 14, 2018
@BarabasGitHub BarabasGitHub deleted the improve-realloc-on-fixed-buffer-allocator branch July 15, 2018 09:19
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