Maps, Slices, and the Go Garbage Collector

In this lesson, we discuss the operation of the Go GC in relation to maps and slices. The purpose of this lesson is to let us write code that makes the work of the GC easier.

Using a slice

The example in this section uses a slice to store a large number of structures. Each structure stores two integer values. This is implemented in sliceGC.go as follows:

Get hands-on with 1200+ tech skills courses.