3 ms·
alloca is just a couple of instructions to allocate more memory on the stack, it is much faster than malloc for pretty much every reason including locality and
by CyberDildonics 1y ago
alloca is just a couple of instructions to allocate more memory on the stack, it is much faster than malloc for pretty much every reason including locality and the fact that it doesn't have to be freed because it goes away after the current scope.
- 1718627440 1y agoIs there a difference between: T * ptr = alloca (size); and char buffer[size]; T * ptr = &buffer; under the assumption that this happens at the top-level of a function?
- CyberDildonics 1y agoNot that I know of