data-structures-c
|
Best-fit free list allocator. More...
#include <stdalign.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include "align.h"
#include "rbtree.h"
Go to the source code of this file.
Classes | |
struct | freelist_header |
Freelist header definition. This lies at the front of every block. More... | |
struct | freelist |
Freelist struct definition. More... | |
Functions | |
static struct freelist_header | freelist_header_from (const bool is_freed, const size_t prev_size, const size_t curr_size) |
static size_t | freelist_header_prev_size (const struct freelist_header *header) |
static bool | freelist_header_is_freed (const struct freelist_header *header) |
static struct freelist_header * | freelist_header_prev (struct freelist_header *header) |
static struct freelist_header * | freelist_header_next (struct freelist_header *header, const struct freelist *freelist_ptr) |
static bool | freelist_header_should_be_in_freetree (const struct freelist_header *header) |
static void | freelist_deallocate_all (struct freelist *self) |
static void | freelist_init (struct freelist *self, const size_t len, unsigned char *backing_buf) |
static void * | freelist_allocate (struct freelist *self, const size_t requested_size) |
static void | freelist_deallocate (struct freelist *self, void *ptr) |
static void * | freelist_reallocate (struct freelist *self, void *ptr, const size_t new_size) |
Best-fit free list allocator.
Sources used:
Inspiration: