It's not entirely clear to me how Mark-and-sweep algorithm works.
This algorithm reduces the definition of "an object is no longer needed" to "an object is unreachable".
It turns out that this algorithm works only with references on objects and doesn't clear global variables, functions... at all. Does it?