When the array goes out of scope its reference count is decremented. If the reference count goes to zero (implying there are no more references) the memory is released.
I would have believed the same, and that's why I believed that
$tmp = [0..100000]; followed by $tmp = 1;would free memory (no more reference to the anonymous array), but Perrin is telling me this is not the case.