Add reference to the official Go GC guide (#19)

This commit is contained in:
Nick Ripley 2022-09-20 04:03:21 -04:00 committed by GitHub
parent ea39719244
commit 6ab2a357b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -64,6 +64,8 @@ However, the model above should be sufficient to understand the remainder of thi
The other major abstraction in Go is the garbage collector. In languages like C, the programmer needs to manually deal with allocating and releasing memory using `malloc()` and `free()`. This offers great control, but turns out to be very error prone in practice. A garbage collector can reduce this burden, but the automatic management of memory can easily become a performance bottleneck. This section of the guide will present a simple model for Go's GC that should be useful for identifying and optimizing memory management related problems.
For a more in-depth guide on Go's GC, refer to the [official documentation](https://go.dev/doc/gc-guide).
#### The Stack
Let's start with the basics. Go can allocate memory in one of two places, the stack or the heap. Each goroutine has its own stack which is a contiguous area of memory. Additionally there is a big area of memory shared between goroutines that is called the heap. This can be seen in the picture below.