Give memory utils their own file, misc cleanups.