2 ms·
This is quite common because the alloc() call itself would panic if out-of-memory. Remember, a large proportion of C code is for embedded/real-time systems whe
by TickleSteve 11y ago
This is quite common because the alloc() call itself would panic if out-of-memory.
Remember, a large proportion of C code is for embedded/real-time systems where the only sensible recovery option is to reset.
Attempting to 'handle' an error manually in every case is simply not possible. Better to reset and come up in a clean state than propagate errors.
Having said that, dynamic memory allocation is itself frowned upon in embedded systems.