|
|
@ -16,23 +16,23 @@ struct TopLevel { |
|
|
|
|
|
|
|
// All three of these types should be memory-compatible with each other |
|
|
|
|
|
|
|
struct TreeAlloc { |
|
|
|
typedef struct TreeAlloc { |
|
|
|
char type; // Should be RT_TREE_NODE |
|
|
|
struct TreeAlloc *parent; |
|
|
|
struct TreeAlloc *left; |
|
|
|
struct TreeAlloc *right; |
|
|
|
size_t size; |
|
|
|
} |
|
|
|
} TreeAlloc |
|
|
|
|
|
|
|
struct FreeSpace { |
|
|
|
typedef struct FreeSpace { |
|
|
|
char type; // Should be RT_FREESPACE |
|
|
|
struct FreeSpace *parent; |
|
|
|
struct FreeSpace *left; |
|
|
|
struct FreeSpace *right; |
|
|
|
size_t size; |
|
|
|
} |
|
|
|
} FreeSpace |
|
|
|
|
|
|
|
struct WatermarkAlloc { |
|
|
|
typedef struct WatermarkAlloc { |
|
|
|
char type; // Should be RT_WATERMARK |
|
|
|
struct TreeAlloc *parent; |
|
|
|
struct TreeAlloc *left; |
|
|
@ -40,10 +40,10 @@ struct WatermarkAlloc { |
|
|
|
size_t size; |
|
|
|
int num_allocs; |
|
|
|
void *next_alloc; |
|
|
|
} |
|
|
|
} WatermarkAlloc |
|
|
|
|
|
|
|
struct TreeAlloc *insert_node_at(void *address, int padding, int align, int size); |
|
|
|
struct TreeAlloc *search_by_address(TreeAlloc *root, void *address); |
|
|
|
struct TreeAlloc *search_by_size(TreeAlloc *root, int padding, int align, int size); |
|
|
|
TreeAlloc *insert_node_at(void *address, int padding, int align, int size); |
|
|
|
TreeAlloc *search_by_address(TreeAlloc *root, void *address); |
|
|
|
TreeAlloc *search_by_size(TreeAlloc *root, int padding, int align, int size); |
|
|
|
|
|
|
|
#endif |