Split freeMemoryIfNeeded into NDS and non-NDS versions

There are a lot of logic changes in freeMemoryIfNeeded for NDS support, and
rather than potentially introduce bugs in the non-NDS version, let's just
keep 'em separate.