Hacker News new | ask | show | jobs
by pjmlp 262 days ago
Why, are you going to abort if too many calls to the allocator take place?
1 comments

You can if you want. You can write your own allocator that never actually touches the heap and just distributes memory from a big chunk on the stack if you want to. The point is you have fine grained (per function) control over the allocation strategy not only in your codebase but also your dependencies.
Allocation strategy isn't the same as knowing exactly exactly when allocations take place.

You missed the point that libraries can have their own allocators and don't expose customisation points.

sure they can. but why would they choose to?
Because the language doesn't prevent them, and they own their library.
That's not really an argument. What prevents the author of a library in any language from acting in bad faith and use antipatterns? That's not a problem that would only happen in the Zig language.
the question remains – why would they choose to?
Because they decided to do so, regardless of people like yourself thinking they are wrong.