Me@50: /* Me@50: * Copyright 2009 OpenSourceCodeStewardshipFoundation.org Me@50: * Licensed under GNU General Public License version 2 Me@50: * Me@50: * Author: seanhalle@yahoo.com Me@50: * Me@50: * Created on November 14, 2009, 9:07 PM Me@50: */ Me@50: Me@65: #ifndef _VMALLOC_H Me@65: #define _VMALLOC_H Me@65: Me@50: #include Me@50: #include "VMS_primitive_data_types.h" Me@50: Me@50: typedef struct _MallocProlog MallocProlog; Me@50: Me@50: struct _MallocProlog Me@50: { Me@50: MallocProlog *nextChunkInFreeList; Me@50: MallocProlog *prevChunkInFreeList; Me@50: MallocProlog *nextHigherInMem; Me@50: MallocProlog *nextLowerInMem; Me@50: }; Me@50: //MallocProlog Me@50: Me@50: typedef struct Me@50: { Me@50: MallocProlog *firstChunkInFreeList; Me@50: int32 numInList; Me@50: } Me@50: FreeListHead; Me@50: Me@66: typedef struct Me@66: { Me@66: int32 hasNewStructs; Me@66: int32 sizeOfStructs; Me@66: int32 currArraySize; Me@66: void **arrays; Me@66: PrivDynArrayInfo *arraysInfo; Me@66: char *ptrToNextStruct; Me@66: char *ptrToTopOfCurrArray; Me@66: PrivQueueStruc *recycleQ; Me@66: } Me@66: VMSRecyclePool; Me@66: Me@50: void * Me@50: VMS__malloc( int32 sizeRequested ); Me@50: Me@50: void Me@50: VMS__free( void *ptrToFree ); Me@50: Me@53: /*Allocates memory from the external system -- higher overhead Me@53: */ Me@53: void * Me@53: VMS__malloc_in_ext( int32 sizeRequested ); Me@53: Me@53: /*Frees memory that was allocated in the external system -- higher overhead Me@53: */ Me@53: void Me@53: VMS__free_in_ext( void *ptrToFree ); Me@53: Me@53: Me@50: MallocProlog * Me@53: VMS_ext__create_free_list(); Me@50: Me@50: void Me@50: VMS_ext__free_free_list( MallocProlog *freeListHead ); Me@65: Me@66: //========================================================================== Me@66: Me@66: VMSRecyclePool * Me@66: VMS__make_recycle_pool( int32 sizeOfStructsToHold ); Me@66: Me@66: void * Me@66: VMS__get_from_recycle_pool( VMSRecyclePool *pool ); Me@66: Me@66: void Me@66: VMS__recycle( void *chunkToRecycle, VMSRecyclePool *pool ); Me@66: Me@66: void Me@66: VMS__free_recycle_pool( VMSRecyclePool *pool ); Me@66: Me@65: #endif