3 ms·
It's a bit funny to call this "runtime" when malloc/free are nothing but library functions.
by jstimpfle 2y ago
It's a bit funny to call this "runtime" when malloc/free are nothing but library functions.
- yxhuvud 2y agoYes, it is a runtime provided by libc, but how on earth is it not a runtime?
- jgalt212 2y agoMaybe the poster considers a runtime something more similar to a global event loop than a set of global functions.
- yxhuvud 2y agoBut libc is more than a set of global functions - it has a bunch of global state associated with them as well. And manipulation of that is what I consider a runtime.
- jstimpfle 2y agoYou can live entirely without malloc(). You don't need it. You can even allocate memory dynamically without malloc, just call a different API. On Windows, it's typical to use e.g. VirtualAlloc(). So thinking of malloc as runtime seems extremely strange to me. libc is not the only library that has "global state". There is nothing special about it. You don't need libc (yes, some compilers / platforms somewhat expect you to bundle libc). And malloc is not libc, although some of the functionality in libc uses malloc internally / gives you back memory that you are expected to free().
- hnlmorg 2y agoYou can get different standard libraries and runtimes for other languages too. That doesn't mean that their de facto compilation and execution method isn't via a runtime.
- jstimpfle 2y agoCall it what you want then; I will continue to refer to malloc/free as library functions since that's what they are to me -- functions that I can call, and if I don't call them, they don't come haunting me.