3 ms·
Many controllers are not hard-realtime. Think e.g. of microwave ovens or smart locks. Often you might be willing to trade a 10ms GC pause of Go for much lower c
by nine_k 9y ago
Many controllers are not hard-realtime. Think e.g. of microwave ovens or smart locks. Often you might be willing to trade a 10ms GC pause of Go for much lower chances of memory corruption or crashing compared to C.
- vvanders 9y agoMany controllers have almost zero memory headroom meaning your GC pauses get an order of magnitude slower if not more as you have less than 2x your working set. Also, most of the applications never allocate because they can't even afford the overhead of pooling/freelists that come with a stock malloc implementation.
- abiox 9y agois a gc all that relevant if you're not dynamically allocating in either case?
- vvanders 9y agoGarbage collection by its nature implies dynamic allocation. You're using value types and raw pointers in those targets because even the memory overhead of a heap/freelist/etc can be too much. With things like AVR you're looking at 512B to 16kB of total memory(part of which includes the code you write).
- abiox 9y ago> Garbage collection by its nature implies dynamic allocation i'm not sure i follow - you're saying that a gc existing implies that one cannot preallocate and avoid dynamic allocation?
- vvanders 9y ago> preallocate This will still use dynamic allocation to do the preallocation. You'll have a heap to track this which comes with its own overhead.
- abiox 9y agoi guess i was using 'dynamic allocation' to mean allocation that occurs in the midst of the main control flow, likely in response to some conditional evaluation (vs upfront).
- vvanders 9y agoYeah, if you allocate in the main loop or preallocate you're still going to pay the overhead of a heap to keep track of those allocation :).
- woah 9y agoI’m developing software for WiFi routers. I would have liked to use Go but the binaries are simply too large and compilation is sketchy for ARM.
- nine_k 9y agoI wonder if Rust could fit your bill better. You can include about as little runtime as you like, no GC or language primitives runtime to carry if you don't choose to.
- themihai 9y ago>> Often you might be willing to trade a 10ms GC pause of Go for much lower chances of memory corruption or crashing compared to C. I believe the C/C++ developers will look for a Rust-like solution(even if I don't like Rust) rather than Go if crashing is an issue. Go doesn't solve the crashing issues. It has its own crashing issues(e.g. dereferencing nil pointers , deadlocks, data-races, nil and nil interfaces etc). If the GC is not an issue they can choose any other GC language so Go is not that special anymore in this regard. The truth is that Go has its own niche and that's web services.