annotate vmalloc.h @ 66:bf08108405cc

Added recycle pool -- will merge later -- need to get PLDI results for now
author Me
date Mon, 15 Nov 2010 12:11:24 -0800
parents 13b22ffb8a2f
children
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>
Me@50 14 #include "VMS_primitive_data_types.h"
Me@50 15
Me@50 16 typedef struct _MallocProlog MallocProlog;
Me@50 17
Me@50 18 struct _MallocProlog
Me@50 19 {
Me@50 20 MallocProlog *nextChunkInFreeList;
Me@50 21 MallocProlog *prevChunkInFreeList;
Me@50 22 MallocProlog *nextHigherInMem;
Me@50 23 MallocProlog *nextLowerInMem;
Me@50 24 };
Me@50 25 //MallocProlog
Me@50 26
Me@50 27 typedef struct
Me@50 28 {
Me@50 29 MallocProlog *firstChunkInFreeList;
Me@50 30 int32 numInList;
Me@50 31 }
Me@50 32 FreeListHead;
Me@50 33
Me@66 34 typedef struct
Me@66 35 {
Me@66 36 int32 hasNewStructs;
Me@66 37 int32 sizeOfStructs;
Me@66 38 int32 currArraySize;
Me@66 39 void **arrays;
Me@66 40 PrivDynArrayInfo *arraysInfo;
Me@66 41 char *ptrToNextStruct;
Me@66 42 char *ptrToTopOfCurrArray;
Me@66 43 PrivQueueStruc *recycleQ;
Me@66 44 }
Me@66 45 VMSRecyclePool;
Me@66 46
Me@50 47 void *
Me@50 48 VMS__malloc( int32 sizeRequested );
Me@50 49
Me@50 50 void
Me@50 51 VMS__free( void *ptrToFree );
Me@50 52
Me@53 53 /*Allocates memory from the external system -- higher overhead
Me@53 54 */
Me@53 55 void *
Me@53 56 VMS__malloc_in_ext( int32 sizeRequested );
Me@53 57
Me@53 58 /*Frees memory that was allocated in the external system -- higher overhead
Me@53 59 */
Me@53 60 void
Me@53 61 VMS__free_in_ext( void *ptrToFree );
Me@53 62
Me@53 63
Me@50 64 MallocProlog *
Me@53 65 VMS_ext__create_free_list();
Me@50 66
Me@50 67 void
Me@50 68 VMS_ext__free_free_list( MallocProlog *freeListHead );
Me@65 69
Me@66 70 //==========================================================================
Me@66 71
Me@66 72 VMSRecyclePool *
Me@66 73 VMS__make_recycle_pool( int32 sizeOfStructsToHold );
Me@66 74
Me@66 75 void *
Me@66 76 VMS__get_from_recycle_pool( VMSRecyclePool *pool );
Me@66 77
Me@66 78 void
Me@66 79 VMS__recycle( void *chunkToRecycle, VMSRecyclePool *pool );
Me@66 80
Me@66 81 void
Me@66 82 VMS__free_recycle_pool( VMSRecyclePool *pool );
Me@66 83
Me@65 84 #endif