- Notifications
You must be signed in to change notification settings - Fork158
binarytrees/1.zig Node allocator#408
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Assigning allocator to every Node object is absurd. Make it static, so that set only once.
3fc55d3 tod70acc7Comparehighfestiva commentedJul 13, 2023
Sounds reasonable. |
rolfscherer commentedAug 7, 2023
I think a bufferd writer is also useful:
An arena allocator should also be faster when releasing memory |
ivanstepanovftw commentedJul 28, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
This is unfair to assign allocator to each node. Rust solution does not store a reference to C allocator |
ivanstepanovftw commentedJun 30, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
It was so fun to read source code once again with a Git blame on.
|
cyrusmsk commentedJun 30, 2025
Hey@hanabi1224 some Zig community people are upset to not having it merged. |
In this Zig code, every Node object had its own allocator. Assigning allocator to every Node object is absurd.
Removing allocator from Node struct would be a simple solution.
However simingly@hanabi1224 does not like that idea because Zig language usually assigns specific allocator to each data structure and it's fair to do so, reflecting the language's norm of its own standard library.
Fine. Zig language allows static members in struct.
So I let specific allocator still remain in Node structure, but it can be changed to be static. The allocator in Node now became static and set only once.