diff vmalloc.c @ 142:1fe7ba1ab81f

bugfixes and typos
author Merten Sach <msach@mailbox.tu-berlin.de>
date Wed, 21 Sep 2011 12:35:11 +0200
parents d0aa5a796fc5
children c3f458403cd6
line diff
     1.1 --- a/vmalloc.c	Wed Sep 07 19:36:46 2011 +0200
     1.2 +++ b/vmalloc.c	Wed Sep 21 12:35:11 2011 +0200
     1.3 @@ -96,7 +96,7 @@
     1.4     
     1.5     //The last element in the list points to the container. If the container points
     1.6     //to NULL the container is empty
     1.7 -   if(*((void**)(chunk->prevChunkInFreeList)) == NULL && getChunkSize(chunk) >= BIG_LOWER_BOUND);
     1.8 +   if(*((void**)(chunk->prevChunkInFreeList)) == NULL && getChunkSize(chunk) >= BIG_LOWER_BOUND)
     1.9     {
    1.10         //Find the approppiate container because we do not know it
    1.11         uint64 containerIdx = ((uintptr_t)chunk->prevChunkInFreeList - (uintptr_t)freeLists->bigChunks) >> 3;
    1.12 @@ -352,7 +352,7 @@
    1.13     
    1.14     firstChunk->nextLowerInMem = NULL;
    1.15     firstChunk->nextHigherInMem = (MallocProlog*)((uintptr_t)firstChunk +
    1.16 -                        MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE - sizeof(MallocProlog*));
    1.17 +                        MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE - sizeof(MallocProlog));
    1.18     firstChunk->nextChunkInFreeList = NULL;
    1.19     //previous element in the queue is the container
    1.20     firstChunk->prevChunkInFreeList = &freeLists->bigChunks[container-2];
    1.21 @@ -360,9 +360,15 @@
    1.22     freeLists->bigChunks[container-2] = firstChunk;
    1.23     //Insert into bit search list
    1.24     if(container <= 65)
    1.25 -       freeLists->bigChunksSearchVector[0] |= ((uint64)1 << (container-2));
    1.26 +   {
    1.27 +       freeLists->bigChunksSearchVector[0] = ((uint64)1 << (container-2));
    1.28 +       freeLists->bigChunksSearchVector[1] = 0;
    1.29 +   }   
    1.30     else
    1.31 -       freeLists->bigChunksSearchVector[1] |= ((uint64)1 << (container-66));
    1.32 +   {
    1.33 +       freeLists->bigChunksSearchVector[0] = 0;
    1.34 +       freeLists->bigChunksSearchVector[1] = ((uint64)1 << (container-66));
    1.35 +   }
    1.36     
    1.37     //Create dummy chunk to mark the top of stack this is of course
    1.38     //never freed