When you have GC pointers (pointers to JS objects, strings, etc.; anything stored directly in the GC heap), you need to handle them specially if they could ever be alive (still valid/reachable) during a collection. I'll first describe what you need to do, then how to do it, and finally why and what happens if you get it wrong.
-
tracing - strong GC references (eg a struct member containing a GC pointer) must be traced so that the GC knows what to keep alive.
-
pre-write barriers aka delete barriers - if you overwrite a GC pointer, you'll need to let the GC know.
-
post-write barriers - after storing a GC pointer somewhere, you need to inform the GC of the new value (or more specifically, the address of the new value or the address of something it knows how to scan to find the value.)