In the mark phase, all program variables are examined to see if they point into the heap.
If so, the block pointed to is "marked".
If an array contains pointers, or a structure contains pointers, thes pointers are examined also.
After the mark phase, heap memory that is not marked is not reachable through the program variables and so is garbage.