From ecc2645ba4c44005ef13e33c79059de69b76551f Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Sun, 16 Jul 2023 16:31:59 -0700 Subject: Add function to query pool capacity. --- mem/include/mem.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'mem/include') diff --git a/mem/include/mem.h b/mem/include/mem.h index 30c24fc..69f426f 100644 --- a/mem/include/mem.h +++ b/mem/include/mem.h @@ -79,6 +79,9 @@ #define mem_get_chunk_handle(MEM, CHUNK_PTR) \ mem_get_chunk_handle_(&(MEM)->mem, CHUNK_PTR) +/// Return the total capacity of the allocator in bytes. +#define mem_capacity(MEM) mem_capacity_(&(MEM)->mem) + /// Iterate over the used chunks of the allocator. /// /// The caller can use 'i' as the index of the current chunk. @@ -147,3 +150,4 @@ void* mem_alloc_(Memory*, size_t num_blocks); void mem_free_(Memory*, void** chunk_ptr); void* mem_get_chunk_(const Memory*, size_t chunk_handle); size_t mem_get_chunk_handle_(const Memory*, const void* chunk); +size_t mem_capacity_(const Memory*); -- cgit v1.2.3