Update memory function to store file lines in correct memory sections.