annotate vmalloc.h @ 126:d0aa5a796fc5

touch memory at start of algorithm to make it comparable
author Merten Sach <msach@mailbox.tu-berlin.de>
date Wed, 07 Sep 2011 14:33:22 +0200
parents e29bb31df078
children 99798e4438a6 0320b49ca013
rev   line source
Me@50 1 /*
Me@50 2 * Copyright 2009 OpenSourceCodeStewardshipFoundation.org
Me@50 3 * Licensed under GNU General Public License version 2
Me@50 4 *
Me@50 5 * Author: seanhalle@yahoo.com
Me@50 6 *
Me@50 7 * Created on November 14, 2009, 9:07 PM
Me@50 8 */
Me@50 9
Me@65 10 #ifndef _VMALLOC_H
Me@65 11 #define _VMALLOC_H
Me@65 12
Me@50 13 #include <malloc.h>
msach@76 14 #include <inttypes.h>
Me@50 15 #include "VMS_primitive_data_types.h"
Me@50 16
msach@101 17 #define SMALL_CHUNK_SIZE 32
msach@101 18 #define SMALL_CHUNK_COUNT 4
msach@125 19 #define LOWER_BOUND 128 //Biggest chunk size that is created for the small chunks
msach@125 20 #define BIG_LOWER_BOUND 160 //Smallest chunk size that is created for the big chunks
msach@101 21
msach@118 22 #define LOG54 0.3219280948873623
msach@118 23 #define LOG128 7
msach@101 24
Me@50 25 typedef struct _MallocProlog MallocProlog;
Me@50 26
Me@50 27 struct _MallocProlog
Me@50 28 {
Me@50 29 MallocProlog *nextChunkInFreeList;
Me@50 30 MallocProlog *prevChunkInFreeList;
Me@50 31 MallocProlog *nextHigherInMem;
Me@50 32 MallocProlog *nextLowerInMem;
Me@50 33 };
Me@50 34 //MallocProlog
msach@101 35
msach@101 36 typedef struct MallocArrays MallocArrays;
msach@101 37
msach@101 38 struct MallocArrays
msach@101 39 {
msach@101 40 MallocProlog **smallChunks;
msach@101 41 MallocProlog **bigChunks;
msach@116 42 uint64 bigChunksSearchVector[2];
msach@102 43 void *memSpace;
msach@101 44 uint32 containerCount;
msach@101 45 };
msach@101 46 //MallocArrays
Me@50 47
Me@50 48 typedef struct
Me@50 49 {
Me@50 50 MallocProlog *firstChunkInFreeList;
msach@76 51 int32 numInList; //TODO not used
Me@50 52 }
Me@50 53 FreeListHead;
Me@50 54
Me@50 55 void *
msach@76 56 VMS__malloc( size_t sizeRequested );
Me@50 57
msach@78 58 void *
msach@78 59 VMS__malloc_aligned( size_t sizeRequested );
msach@78 60
Me@50 61 void
Me@50 62 VMS__free( void *ptrToFree );
Me@50 63
Me@53 64 /*Allocates memory from the external system -- higher overhead
Me@53 65 */
Me@53 66 void *
msach@76 67 VMS__malloc_in_ext( size_t sizeRequested );
Me@53 68
Me@53 69 /*Frees memory that was allocated in the external system -- higher overhead
Me@53 70 */
Me@53 71 void
Me@53 72 VMS__free_in_ext( void *ptrToFree );
Me@53 73
Me@53 74
msach@101 75 MallocArrays *
Me@53 76 VMS_ext__create_free_list();
Me@50 77
Me@50 78 void
msach@102 79 VMS_ext__free_free_list(MallocArrays *freeLists );
Me@65 80
Me@65 81 #endif