The Go runtime library also has functions that you can inject into your program's runtime to emit runtime data. Let's run through a couple of prime examples. A full list of all of the available runtime functions can be found at https://golang.org/pkg/runtime/#pkg-index. Many of the functions that are available in this package are also included in the runtime/pprof package, which we will investigate in more detail in Chapter 12, Profiling Go Code.
Understanding functions
KeepAlive
The runtime.KeepAlive() function expects interface{} and ensures that the object passed to it isn't freed and that its finalizer (as defined by runtime.SetFinalizer) is not run. This keeps the argument passed to KeepAlive reachable...