|
|
|
|
|
by jack_h
12 days ago
|
|
There are roughly two orders of magnitude more microcontrollers in the world running code than application processors. GC is not acceptable on a microcontroller due to the extreme resource constraints. The GP post is correct, Go can replace some use cases for C, but it does not replace all use cases and GC is part of the reason. |
|
Dynamic memory allocation on a microcontroller can be treacherous full stop, but if you have accepted the tradeoffs of using dynamic memory allocation then why not GC? You wouldn't want gc[1]-style GC, but there are other GC algorithms that can work well enough on micros. The Go spec calls for garbage collection, but it doesn't say how you have to collect garbage.
> but it does not replace all use cases
It could replace all use cases. There are arguably much better tools for many jobs[2], but if you had to the language isn't going to stop you.
[1] gc the compiler, not GC garbage collection. Naming is the hardest problem in CS.
[2] Some would say all jobs, but for the sake of discussion let's agree that Go can be a reasonable choice at least sometimes.