I could not find any in-ruby solution for this question, so here is a unix-solution.
def memory pid = Process.pid map = `pmap -d #{pid}` map.split("\n").last end
Output
mapped: 17652K writeable/private: 2180K shared: 0K
Lesson learned
Use `open(file).each(seperator)` over `open(file).read.split(seperator)` if you want to optimize for memory (is slightly slower)