move memory_source to a separate header
line_source is an implementation detail