Automatic memory management (whether done at runtime with a garbage collector, or at compile time as in Rust) frees you from logical memory errors by making them inexpressible. But automatic memory management doesn't guarantee that segfaults won't happen - it only guarantees that they won't matter to the programmer. For example, a garbage collector could deliberately trigger segfaults (by `mprotect()`ing all managed memory) to forcibly pause the mutator during a garbage collection cycle. Every managed thread must install a `SIGSEGV` handler that waits until the collection process is done.
Interesting, is this actually a common implementation pattern for languages that have a GC built into their run time?
Correct. By using GC and banning free() you avoid use-after-free bugs, but not out-of-bounds accesses.
Out of bounds accesses have to be forbidden in some other fashion; most languages do bounds-checking and throw an exception rather than trying to access the memory and getting a segfault (or, worse, reading some random other object's memory).
How does GC protect you from a segfault?
Surely trying that doesn't help you when you attempt to access the 5th element of an array with only two elements. Maybe its just confusing that the author used that as an example. I'm guessing aside form a dangling pointer GC doesn't offer much protection form a segfault?