From a5892b35233748b2fcff1f726314c9a8df749f9c Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Fri, 24 Jan 2020 09:15:46 -0500 Subject: Reviewed stmos, made small format/doc fixes --- src/kernel/heap.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/kernel/heap.h') diff --git a/src/kernel/heap.h b/src/kernel/heap.h index 82d057e..054cb8a 100644 --- a/src/kernel/heap.h +++ b/src/kernel/heap.h @@ -23,6 +23,9 @@ #include +/** + * Internal structure place before memory allocations, to track allocation size. + */ typedef struct { uint32_t size; void *next; @@ -30,13 +33,14 @@ typedef struct { /** * Initializes memory management of the given heap. - * No overflow stuff is done, so... be careful. + * Note: Heap size is not accounted for. * @param buf The heap to use for allocations */ void heap_init(void *buf); /** - * Returns the amount of free, allocatable memory, in bytes. + * Returns the amount of free, allocatable memory, in bytes, assuming that the + * heap has from its initial location to the end of SRAM. * @return Amount of free memory in bytes */ uint32_t heap_free(void); @@ -64,3 +68,4 @@ void *calloc(uint32_t count, uint32_t size); void free(void *buf); #endif // HEAP_H_ + -- cgit v1.2.3