Changed mmap to be passed by reference.