Hacker News
points by dooglius 3 days ago | 0 comments
But if you still have to support the plain free functions it doesn't help because you'd still have to track the information anyway.
[–] wahern 3 days ago
The degree to which it helps or not depends on the implementation. For example, free could be a slow path that does extra bookkeeping lookups the sized variants wouldn't need to. Large allocations and non-default aligned allocations often use different bookkeeping data structures from how most allocations are handled internally anyhow. In such cases that check needs to be done up front, and at least on virtual memory systems (where it's relatively easy to segregate allocations types by VM range) it doesn't much matter whether you're indexing that first level directory based on pointer or size.

But, yeah, it's not an ideal situation from the perspective of free_aligned advocates.

[–] 1718627440 3 days ago
At load time, you do know whether a program is going to use plain free, so you can select the implementation then.
Hacker News