lambda1@tg says to YSITD
(2) is sadly undecidable, a situation much more horrid than being NP-hard. If you're familiar with languages that have garbage collection facilities, you should be wondering, how do they even do that?