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 45 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 50 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 52 of file malloc.h.

Referenced by heap_realloc().

◆ freemem

size_t heap::freemem

Total amount of free memory.

Definition at line 55 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 57 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 59 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 67 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 79 of file malloc.h.

Referenced by heap_free_block().


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