Factor out methods common to all main memories.
get-freq.py fixes.