Hacker News new | past | comments | ask | show | jobs | submit login

Cool project but I think he's still right - you normally don't want GC on your microcontroller and often you don't want heap allocations at all. Very difficult to write Go with those constraints.



Lots of "serious" microcontroller projects are written in MicroPython, Lua (such as eLua), and Espruino (JavaScript).

I think it's simply an outdated oversimplification in 2021 to say that microcontroller projects "normally" don't want heap allocations at all.

TinyGo also makes it relatively easy to avoid heap allocations because you can change a compiler flag to make heap allocations a compiler error^1, if that's required for a particular project.

^1: https://tinygo.org/usage/important-options/ (look at -gc=none)

Another interesting link: https://tinygo.org/compiler-internals/heap-allocation/


It ultimately depends on your definition of “serious” and the microcontrollers we’re talking about.

For performance-sensitive areas where deterministic latency is critical, a GC simply won’t cut it, even if you can control when to run the GC step.

For lower end microcontrollers, I highly doubt any of those solutions would ever work: there is simply too much “magic” (read: overhead) involved.

This is primarily why C is still king of the microcontroller world.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: