|
Pyrogenesis
13997
|
#include "lib/posix/posix_mman.h"Go to the source code of this file.
Classes | |
| struct | DynArray |
| provides a memory range that can be expanded but doesn't waste physical memory or relocate itself. More... | |
Functions | |
| LIB_API Status | da_alloc (DynArray *da, size_t max_size) |
| ready the DynArray object for use. More... | |
| LIB_API Status | da_free (DynArray *da) |
| free all memory (address space + physical) that constitutes the given array. More... | |
| LIB_API Status | da_set_size (DynArray *da, size_t new_size) |
| expand or shrink the array: changes the amount of currently committed (i.e. More... | |
| LIB_API Status | da_reserve (DynArray *da, size_t size) |
| Make sure at least <size> bytes starting at da->pos are committed and ready for use. More... | |
| LIB_API Status | da_append (DynArray *da, const void *data_src, size_t size) |
| "write" to array, i.e. More... | |
ready the DynArray object for use.
no virtual memory is actually committed until calls to da_set_size.
| da | DynArray. |
| max_size | size [bytes] of address space to reserve (*); the DynArray can never expand beyond this. (* rounded up to next page size multiple) |
Definition at line 61 of file dynarray.cpp.
"write" to array, i.e.
copy from the given buffer.
starts at offset DynArray.pos and advances this.
| da | DynArray. |
| data_src | source memory |
| size | [bytes] to copy |
Definition at line 139 of file dynarray.cpp.
free all memory (address space + physical) that constitutes the given array.
use-after-free is impossible because the memory is unmapped.
| da | DynArray* zeroed afterwards. |
Definition at line 80 of file dynarray.cpp.
Make sure at least <size> bytes starting at da->pos are committed and ready for use.
| da | DynArray* |
| size | Minimum amount to guarantee [bytes] |
Definition at line 130 of file dynarray.cpp.
expand or shrink the array: changes the amount of currently committed (i.e.
usable) memory pages.
| da | DynArray. |
| new_size | target size (rounded up to next page multiple). pages are added/removed until this is met. |
Definition at line 93 of file dynarray.cpp.
1.8.5