view vmalloc.h @ 134:a9b72021f053

Distributed memory management w/o free requests working
author Merten Sach <msach@mailbox.tu-berlin.de>
date Fri, 16 Sep 2011 16:19:24 +0200
parents dbfc8382d546
children 0b49fd35afc1
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 */
9 #ifndef _VMALLOC_H
10 #define _VMALLOC_H
12 #include <malloc.h>
13 #include <inttypes.h>
14 #include "VMS_primitive_data_types.h"
15 #include "ProcrContext.h"
17 typedef struct _MallocProlog MallocProlog;
19 struct _MallocProlog
20 {
21 MallocProlog *nextChunkInFreeList;
22 MallocProlog *prevChunkInFreeList;
23 MallocProlog *nextHigherInMem;
24 MallocProlog *nextLowerInMem;
25 };
26 //MallocProlog
28 typedef struct
29 {
30 uintptr_t procrID;
31 MallocProlog *prevChunkInFreeList;
32 MallocProlog *nextHigherInMem;
33 MallocProlog *nextLowerInMem;
34 } MallocPrologAllocated;
36 typedef struct
37 {
38 MallocProlog *firstChunkInFreeList;
39 int32 numInList; //TODO not used
40 } FreeListHead;
42 void *
43 VMS__malloc_on_core(size_t sizeRequested, int procrID);
45 void *
46 VMS__malloc(size_t sizeRequested);
48 void *
49 VMS__malloc_in_lib(size_t sizeRequested, VirtProcr *VProc);
51 void
52 VMS__free( void *ptrToFree );
54 void
55 VMS__free_in_lib(void *ptrToFree, VirtProcr *VProc);
57 void
58 VMS__free_on_core(void *ptrToFree, int procrID);
60 /*Allocates memory from the external system -- higher overhead
61 */
62 void *
63 VMS__malloc_in_ext( size_t sizeRequested );
65 /*Frees memory that was allocated in the external system -- higher overhead
66 */
67 void
68 VMS__free_in_ext( void *ptrToFree );
70 MallocProlog *
71 VMS_ext__create_free_list();
73 void
74 VMS_ext__free_free_list( MallocProlog* freeListHeads[] );
76 #endif