aboutsummaryrefslogtreecommitdiff
path: root/lib/heap.c
AgeCommit message (Collapse)Author
2023-11-01heap_free_page returns true if page was successfully deletedAryadev Chavali
2023-11-01Heap now maintains a new page per allocationAryadev Chavali
Instead of having each page be an area of memory, where multiple pointers to differing data may lie, we instead have each page being one allocation. This ensures that a deletion algorithm, as provided, would actually work without destroying older pointers which may have been allocated. Great!
2023-11-01Added an arena allocatorAryadev Chavali
A page is a flexibly allocated structure of bytes, with a count of the number of bytes already allocated (used) and number of bytes available overall (available), with a pointer to the next page, if any. heap_t is a linked list of pages. One may allocate a requested size off the heap which causes one of two things: 1) Either a page already exists with enough space for the requested size, in which case that page's pointer is used as the base for the requested pointer 2) No pages satisfy the requested size, so a new page is allocated which is the new end of the heap.