|
BenBot 1.7.5
A chess engine
|
Files | |
| file | Memory.hpp |
Namespaces | |
| namespace | util |
| namespace | util::memory |
Functions | |
| auto | util::memory::page_aligned_alloc (size_t size) -> void * |
| void | util::memory::page_aligned_free (void *mem) |
| void | util::memory::prefetch (const void *mem) |
Memory handling utility functions used throughout the code.
|
nodiscard |
Allocates memory aligned by page size, with a minimum alignment of 4096 bytes. Memory allocated by this function must be freed by calling page_aligned_free(). Returns nullptr if the memory could not be allocated.
| void util::memory::page_aligned_free | ( | void * | mem | ) |
Frees page-aligned memory allocated by page_aligned_alloc(). This is a no-op if mem is nullptr.
| void util::memory::prefetch | ( | const void * | mem | ) |
Hints the CPU to prefetch the page that the given memory address is on. This function is nonblocking, and may be a no-op depending on the target platform.