Mercurial > hg > Game > Cerium
changeset 1996:9657434c21a4 draft
change memory allocate function malloc() to manager->allocate in my_read
author | Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 21 Apr 2014 18:49:21 +0900 |
parents | c961cc335471 |
children | 48419ad1ade5 |
files | example/word_count/main.cc |
diffstat | 1 files changed, 3 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/example/word_count/main.cc Mon Apr 21 00:02:36 2014 +0900 +++ b/example/word_count/main.cc Mon Apr 21 18:49:21 2014 +0900 @@ -47,7 +47,7 @@ } st_mmap_t; static void -my_read(char *filename, WordCount *w) +my_read(char *filename, WordCount *w, TaskManager *manager) { /*マッピングだよ!*/ struct stat sb; @@ -62,8 +62,7 @@ } //madvise(w->file_mmap, w->read_filesize, POSIX_MADV_NORMAL); - //w->file_mmap = (char*)mmap(NULL,w->read_filesize,PROT_READ,map,fd,(off_t)0); - w->file_mmap = (char*)malloc(w->read_filesize); + w->file_mmap = (char*)manager->allocate(w->read_filesize); read(fd, w->file_mmap, w->read_filesize); if (w->file_mmap == (caddr_t)-1) { @@ -307,7 +306,7 @@ w->file_mmap = (char*)manager->allocate(w->read_filesize); }else if (read_type == MY_READ) { printf("[single read mode]\n"); - my_read(filename, w); + my_read(filename, w, manager); }else if(read_type == MY_MMAP) { printf("[mmap mode]\n"); my_mmap(filename, w);