Can a devious C programmer break the collector?
Certainly, but most people have better ways to spend their time than dreaming up ways to break their tools. The collector does rely on being able to locate copies of pointers somewhere in an address space, so certain things won’t work. For instance, the XOR’d pointers trick for compactly encoding a bidirectional list cannot be used — the pointers don’t look like pointers. If a process writes pointers to a file, and reads them back again, the memory referenced by those pointers may have been recycled. Most programs don’t do these things, so most programs work with a garbage collector. Ordinary (legal) pointer arithmetic is tolerated by garbage collectors for C. One problem described by a team considering the use of GC is the use of pointer mangling to get “really opaque” pointers. That is, pointers handed out from a package to a client are XORed with a random number chosen at program start time, and thus the client cannot access package data structures without going through defined int