Redesign of the Allocator interface #957
Replies: 6 comments
-
One thing you lose with this is it could be hard to make an allocater that record what you're doing such as a leakchecking allocator or something that just helps you visualize what kind of allocations, frees etc that you're doing since you no longer have the mode, |
Beta Was this translation helpful? Give feedback.
-
You can figure out the mode from the inputs, but yes, it is less explicit. |
Beta Was this translation helpful? Give feedback.
-
Well yes and no, you can guess the mode from input but what if it was something that was passed as as an error? You would then incorrectly assume the wrong mode |
Beta Was this translation helpful? Give feedback.
-
You can incorrectly pass the wrong mode, so don't see how that's a valid argument :) |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
You can pass the incorrect mode yes but I think that's a lot easier to spot |
Beta Was this translation helpful? Give feedback.
-
Current Interface:
Proposed Interface (General Idea):
Current Interface:
rawptr
for memoryProposed Interface:
realloc
meaning thatfree
andalloc
map torealloc
malloc(size) == realloc(NULL, size)
andfree(ptr) == realloc(ptr, 0)
[]byte
for memoryBeta Was this translation helpful? Give feedback.
All reactions