iPXE
Data Fields
heap Struct Reference

A heap. More...

#include <malloc.h>

Data Fields

struct list_head blocks
 List of free memory blocks. More...
 
size_t align
 Alignment for free memory blocks. More...
 
size_t ptr_align
 Alignment for size-tracked allocations. More...
 
size_t freemem
 Total amount of free memory. More...
 
size_t usedmem
 Total amount of used memory. More...
 
size_t maxusedmem
 Maximum amount of used memory. More...
 
unsigned int(* grow )(size_t size)
 Attempt to grow heap (optional) More...
 
unsigned int(* shrink )(void *ptr, size_t size)
 Allow heap to shrink (optional) More...
 

Detailed Description

A heap.

Definition at line 44 of file malloc.h.

Field Documentation

◆ blocks

struct list_head heap::blocks

◆ align

size_t heap::align

Alignment for free memory blocks.

Definition at line 49 of file malloc.h.

Referenced by check_blocks(), heap_alloc_block(), heap_free_block(), and heap_populate().

◆ ptr_align

size_t heap::ptr_align

Alignment for size-tracked allocations.

Definition at line 51 of file malloc.h.

Referenced by heap_realloc().

◆ freemem

size_t heap::freemem

Total amount of free memory.

Definition at line 54 of file malloc.h.

Referenced by heap_alloc_block(), and heap_free_block().

◆ usedmem

size_t heap::usedmem

Total amount of used memory.

Definition at line 56 of file malloc.h.

Referenced by heap_alloc_block(), heap_free_block(), and heap_populate().

◆ maxusedmem

size_t heap::maxusedmem

Maximum amount of used memory.

Definition at line 58 of file malloc.h.

Referenced by heap_alloc_block(), and shutdown_cache().

◆ grow

unsigned int( * heap::grow) (size_t size)

Attempt to grow heap (optional)

Parameters
sizeFailed allocation size
Return values
grownHeap has grown: retry allocations

Definition at line 66 of file malloc.h.

Referenced by heap_alloc_block().

◆ shrink

unsigned int( * heap::shrink) (void *ptr, size_t size)

Allow heap to shrink (optional)

Parameters
ptrStart of free block
sizeSize of free block
Return values
shrunkHeap has shrunk: discard block

Note that the discarded block will be accessed once after this method returns, in order to clear the free block metadata.

Definition at line 78 of file malloc.h.

Referenced by heap_free_block().


The documentation for this struct was generated from the following file: