#ifndef HEAP_H #define HEAP_H #include #include #include "block_header.h" #define NUM_HEAPS 4 /** * A structure to represent a maptable node * * Heaps contain */ typedef struct maptable_node_s { unsigned int size; /**< the size of the blocks of the fixed list */ void *fixed_list_head; /**< pointer to the head node of the fixed list */ struct maptable_node_s *next; /**< pointer to the next node of the maptable */ } maptable_node_t; typedef struct dmmstats_s { uint32_t max_mem_allocated; /**< maximum total memory allocated */ uint32_t max_mem_requested; /**< maximum total memory requested */ uint32_t mem_allocated; /**< total memory currently allocated */ uint32_t mem_requested; /**< total memory currently requested */ uint32_t live_objects; /**< number of live objects */ uint32_t read_mem_accesses; /**< number of read accesses */ uint32_t write_mem_accesses; /**< number of write accesses */ uint32_t num_malloc; /**< number of malloc()'s served */ uint32_t num_free; /**< number of free()'s served */ } dmmstats_t; typedef struct dmmknobs_s { uint32_t maxCoalesceSize; uint32_t minSplitSize; float empty_threshold; uint32_t percentage; char frag_state; //FIXME It was in the old code to refresh the frag check } dmmknobs_t; typedef struct heap_s { maptable_node_t *maptable_head; void *free_list_head; void *used_blocks_head; void *rov_ptr; uint64_t num_objects; dmmstats_t dmm_stats; dmmknobs_t dmm_knobs; pthread_mutex_t mutex; } heap_t; typedef struct allocator_s { heap_t heaps[NUM_HEAPS]; } allocator_t; #endif /* HEAP_H */