Microchip® Advanced Software Framework

membag.h File Reference

Memory Bag allocator for 8-bit AVR, 32-bit AVR, SAM.

Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.

#include <stddef.h>

Macros

#define MEMBAG(objsize, nr_objs)   { .block_size = objsize, .num_blocks = nr_objs }
 Macro used to create memory bags in conf_membag.h. More...
 
#define MEMBAG_SIZE(objsize, nr_objs)   (objsize * nr_objs)
 Macro used to store the size of the membags in conf_membag.h. More...
 

Functions

void * membag_alloc (const size_t size)
 Allocate a memory block via a block from the Membag pool. More...
 
void membag_free (const void *ptr)
 Free a previously allocated memory block from the Membag pool. More...
 
size_t membag_get_largest_free_block_size (void)
 Determine the largest available block size. More...
 
size_t membag_get_smallest_free_block_size (void)
 Determine the smallest available block size. More...
 
size_t membag_get_total (void)
 Determine the total memory from all membags. More...
 
size_t membag_get_total_free (void)
 Determine the total remaining free memory from all membags. More...
 
void membag_init (void)
 Initialize the membag system. More...