# HG changeset patch # User Merten Sach # Date 1316601311 -7200 # Node ID 1fe7ba1ab81faf31e8971b5f2b1e9a3791625753 # Parent 90cbb7b803eeefa8fa5c88a2f38a933d9381fccf bugfixes and typos diff -r 90cbb7b803ee -r 1fe7ba1ab81f vmalloc.c --- a/vmalloc.c Wed Sep 07 19:36:46 2011 +0200 +++ b/vmalloc.c Wed Sep 21 12:35:11 2011 +0200 @@ -96,7 +96,7 @@ //The last element in the list points to the container. If the container points //to NULL the container is empty - if(*((void**)(chunk->prevChunkInFreeList)) == NULL && getChunkSize(chunk) >= BIG_LOWER_BOUND); + if(*((void**)(chunk->prevChunkInFreeList)) == NULL && getChunkSize(chunk) >= BIG_LOWER_BOUND) { //Find the approppiate container because we do not know it uint64 containerIdx = ((uintptr_t)chunk->prevChunkInFreeList - (uintptr_t)freeLists->bigChunks) >> 3; @@ -352,7 +352,7 @@ firstChunk->nextLowerInMem = NULL; firstChunk->nextHigherInMem = (MallocProlog*)((uintptr_t)firstChunk + - MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE - sizeof(MallocProlog*)); + MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE - sizeof(MallocProlog)); firstChunk->nextChunkInFreeList = NULL; //previous element in the queue is the container firstChunk->prevChunkInFreeList = &freeLists->bigChunks[container-2]; @@ -360,9 +360,15 @@ freeLists->bigChunks[container-2] = firstChunk; //Insert into bit search list if(container <= 65) - freeLists->bigChunksSearchVector[0] |= ((uint64)1 << (container-2)); + { + freeLists->bigChunksSearchVector[0] = ((uint64)1 << (container-2)); + freeLists->bigChunksSearchVector[1] = 0; + } else - freeLists->bigChunksSearchVector[1] |= ((uint64)1 << (container-66)); + { + freeLists->bigChunksSearchVector[0] = 0; + freeLists->bigChunksSearchVector[1] = ((uint64)1 << (container-66)); + } //Create dummy chunk to mark the top of stack this is of course //never freed