fixed memory.rb to use file-like write() in MemPointer class