There's a problem in the annotated line: if we allocate a snEntry in the
stable name table, but run out of heap to actually allocate the StgStableName
we call GC with incorrect snEntry contents. As a reminder, this is snEntry:

typedef struct { StgPtr addr; // Haskell object when entry is in use, next free // entry (NULL when this is the last free entry) // otherwise. May be NULL temporarily during GC (when // pointee dies). StgPtr old; // Old Haskell object, used during GC StgClosure *sn_obj; // The StableName object, or NULL when the entry is // free} snEntry;

In summary, sn_obj == NULL means the entry is free. When we trigger the GC
after allocating the snEntry but before allocating the StgStableName, we end
up calling the GC with sn_obj == NULL even though the snEntry is not
actually free. In particular, the addr field should be updated by
gcStableNameTable, but it's currently not because gcStableNameTable sees
sn_obj as NULL and skips the entry.