changed to use mmap instead of new/delete