Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
diff vmalloc.c @ 81:a214c84dff4e
malloc_touch
| author | Merten Sach <msach@mailbox.tu-berlin.de> |
|---|---|
| date | Mon, 11 Jul 2011 20:35:54 +0200 |
| parents | 97e26095c01f |
| children | 21c95d402fe6 |
line diff
1.1 --- a/vmalloc.c Mon Jul 11 20:29:26 2011 +0200 1.2 +++ b/vmalloc.c Mon Jul 11 20:35:54 2011 +0200 1.3 @@ -451,13 +451,13 @@ 1.4 firstChunk = malloc( MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE ); 1.5 if( firstChunk == NULL ) {printf("malloc error\n"); exit(1);} 1.6 1.7 - //Touch memory to avoid page faults 1.8 - //void *ptr,*endPtr; 1.9 - //endPtr = (void*)firstChunk+MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE; 1.10 - //for(ptr = firstChunk; ptr < endPtr; ptr+=PAGE_SIZE) 1.11 - //{ 1.12 - // *(char*)ptr = 0; 1.13 - //} 1.14 + Touch memory to avoid page faults 1.15 + void *ptr,*endPtr; 1.16 + endPtr = (void*)firstChunk+MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE; 1.17 + for(ptr = firstChunk; ptr < endPtr; ptr+=PAGE_SIZE) 1.18 + { 1.19 + *(char*)ptr = 0; 1.20 + } 1.21 1.22 freeListHead->prevChunkInFreeList = NULL; 1.23 //Use this addr to free the heap when cleanup
