|
|
|
|
|
by endymi0n
2541 days ago
|
|
If I was relying on an electronic device to protect my health I‘d trust my garbage collected code on a 64 bit ARM CPU using real CPU timers way more than my own ability to not segfault or OOM myself to death (literally) with low-level embedded C code. YMMV. |
|
In most cases, MCU IDE's like the classic Arduino one don't even give you an allocator, all data must be statically allocated beforehand.
IIRC it doesn't use the stack either. The main() and loop() functions initialize all their variables statically.
When you have 2KB of memory to share between code, data and stack, allocating and using stack for function calls is luxury that only introduces problems.
Hence, I've never ever ever seen an MCU crash from segfaults or OOMs.
On the plus side they will also use vastly less energy. 10 Milliamps is enough to drive a ESP8266 or ESP32, in deep sleep you start counting microamps. A single battery cell can easily last a month.