comparison vmalloc.c @ 156:b86c54dfb19f

smaller Hists for malloc, free and plugin
author Merten Sach <msach@mailbox.tu-berlin.de>
date Thu, 06 Oct 2011 15:55:42 +0200
parents a214c84dff4e
children ca154ebe2b6c dbfc8382d546 c1784868dcea
comparison
equal deleted inserted replaced
11:1fc17791b3e7 12:a0b38c64a0b6
449 // thread's original stack available 449 // thread's original stack available
450 freeListHead = malloc( sizeof(MallocProlog) ); 450 freeListHead = malloc( sizeof(MallocProlog) );
451 firstChunk = malloc( MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE ); 451 firstChunk = malloc( MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE );
452 if( firstChunk == NULL ) {printf("malloc error\n"); exit(1);} 452 if( firstChunk == NULL ) {printf("malloc error\n"); exit(1);}
453 453
454 Touch memory to avoid page faults 454 //Touch memory to avoid page faults
455 void *ptr,*endPtr; 455 void *ptr,*endPtr;
456 endPtr = (void*)firstChunk+MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE; 456 endPtr = (void*)firstChunk+MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE;
457 for(ptr = firstChunk; ptr < endPtr; ptr+=PAGE_SIZE) 457 for(ptr = firstChunk; ptr < endPtr; ptr+=PAGE_SIZE)
458 { 458 {
459 *(char*)ptr = 0; 459 *(char*)ptr = 0;