March 2020
Intermediate to advanced
406 pages
8h 39m
English
If you are running Go on an embedded device or a device with very constrained memory, it's sometimes smart to understand some of the underlying processes within the runtime to make informed decisions regarding your processes. The Go garbage collector prioritizes low latency and simplicity. It uses a non-generational concurrent tri-color mark and sweep garbage collector. By default, it manages memory allocation automatically.
Go has a function in the debug standard library that will force a garbage collection and return memory to the OS. The Go garbage collector returns unused memory to the OS after 5 minutes. If you are running on a low memory device, this function, FreeOSMemory(), can be found here: ...
Read now
Unlock full access