It is a scope issue. Memory management operates on when a variable is no longer applicable, so when it exits that variable's scope. Since a global variable's scope is the whole program, it would be never recognized as out of scope.