Malloc() and free() are a bad API (2022)(foonathan.net) |
Malloc() and free() are a bad API (2022)(foonathan.net) |
Modern CPUs have more memory built in to L1, L2, and L3 caches than most computers had in total working memory until memory started getting cheap.
I agree with the author that has lead to some "sharp edges" for the API, but that is a normal growth pattern. I'm not saying that the API doesn't have to change, but I did want to make sure that people understand that the creators of the old APIs were not stupid, they just faced different constraints than we do now. And that led to API "shapes" that may be surprising and frustrating to use now, but made perfectly good sense at the time.
So then there is always the helpful macro, doing what should have been a language feature in first place.