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

Merged
merged 4 commits into from Jul 14, 2018

Conversation

Projects
None yet
2 participants
@BarabasGitHub
Contributor

BarabasGitHub commented Jul 14, 2018

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

This comment has been minimized.

Member

andrewrk commented Jul 14, 2018

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

1 of 2 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@BarabasGitHub BarabasGitHub deleted the BarabasGitHub:improve-realloc-on-fixed-buffer-allocator branch Jul 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment