Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
view 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 |
line source
1 /*
2 * Copyright 2009 OpenSourceCodeStewardshipFoundation.org
3 * Licensed under GNU General Public License version 2
4 *
5 * Author: seanhalle@yahoo.com
6 *
7 * Created on November 14, 2009, 9:07 PM
8 */
10 #ifndef _VMALLOC_H
11 #define _VMALLOC_H
13 #include <malloc.h>
14 #include <inttypes.h>
15 #include "VMS_primitive_data_types.h"
17 #define SMALL_CHUNK_SIZE 32
18 #define SMALL_CHUNK_COUNT 4
19 #define LOWER_BOUND 128 //Biggest chunk size that is created for the small chunks
20 #define BIG_LOWER_BOUND 160 //Smallest chunk size that is created for the big chunks
22 #define LOG54 0.3219280948873623
23 #define LOG128 7
25 typedef struct _MallocProlog MallocProlog;
27 struct _MallocProlog
28 {
29 MallocProlog *nextChunkInFreeList;
30 MallocProlog *prevChunkInFreeList;
31 MallocProlog *nextHigherInMem;
32 MallocProlog *nextLowerInMem;
33 };
34 //MallocProlog
36 typedef struct MallocArrays MallocArrays;
38 struct MallocArrays
39 {
40 MallocProlog **smallChunks;
41 MallocProlog **bigChunks;
42 uint64 bigChunksSearchVector[2];
43 void *memSpace;
44 uint32 containerCount;
45 };
46 //MallocArrays
48 typedef struct
49 {
50 MallocProlog *firstChunkInFreeList;
51 int32 numInList; //TODO not used
52 }
53 FreeListHead;
55 void *
56 VMS__malloc( size_t sizeRequested );
58 void *
59 VMS__malloc_aligned( size_t sizeRequested );
61 void
62 VMS__free( void *ptrToFree );
64 /*Allocates memory from the external system -- higher overhead
65 */
66 void *
67 VMS__malloc_in_ext( size_t sizeRequested );
69 /*Frees memory that was allocated in the external system -- higher overhead
70 */
71 void
72 VMS__free_in_ext( void *ptrToFree );
75 MallocArrays *
76 VMS_ext__create_free_list();
78 void
79 VMS_ext__free_free_list(MallocArrays *freeLists );
81 #endif
