3 ms·
I've written code exactly like that and realised that it just kicks the can down the road: you're still allocating memory from a fixed block, it's just now the
by baot 7y ago
I've written code exactly like that and realised that it just kicks the can down the road: you're still allocating memory from a fixed block, it's just now the malloc is written by you, with more bugs, and you still need to deal with variable allocation delays and running out of memory. The real issue is if you don't know at compile-time what resources you'll need at run-time. For some problems that can be an intractable problem for making a safe product, including, to my knowledge, everything that runs on a rich OS.
- carlmr 7y ago>The real issue is if you don't know at compile-time what resources you'll need at run-time. For some problems that can be an intractable problem for making a safe product, including, to my knowledge, everything that runs on a rich OS. You're right, but you should still constrain yourself to these few instances to use malloc instead of wildly using it everywhere.