Memory management static class.
More...
#include <memory.h>
|
| static int64_t | RamTotal () |
| | Total RAM in bytes.
|
| |
| static int64_t | RamFree () |
| | Free RAM in bytes.
|
| |
| static bool | IsZero (const void *buffer, size_t size) noexcept |
| | Is the given memory buffer filled with zeros?
|
| |
| static bool | IsValidAlignment (size_t alignment) noexcept |
| | Is the given alignment valid?
|
| |
| template<typename T > |
| static bool | IsAligned (const T *address, size_t alignment=alignof(T)) noexcept |
| | Is the given pointer aligned?
|
| |
| template<typename T > |
| static T * | Align (const T *address, size_t alignment=alignof(T), bool upwards=true) noexcept |
| | Align pointer (upwards or downwards)
|
| |
| static void | ZeroFill (void *buffer, size_t size) |
| | Fill the given memory buffer with zeros.
|
| |
| static void | RandomFill (void *buffer, size_t size) |
| | Fill the given memory buffer with random bytes.
|
| |
| static void | CryptoFill (void *buffer, size_t size) |
| | Fill the given memory buffer with cryptographic strong random bytes.
|
| |
Memory management static class.
Provides memory management functionality such as total and free RAM available.
Thread-safe.
Definition at line 31 of file memory.h.
◆ Memory() [1/3]
| CppCommon::Memory::Memory |
( |
| ) |
|
|
delete |
◆ Memory() [2/3]
| CppCommon::Memory::Memory |
( |
const Memory & |
| ) |
|
|
delete |
◆ Memory() [3/3]
| CppCommon::Memory::Memory |
( |
Memory && |
| ) |
|
|
delete |
◆ ~Memory()
| CppCommon::Memory::~Memory |
( |
| ) |
|
|
delete |
◆ Align()
template<typename T >
| T * CppCommon::Memory::Align |
( |
const T * |
address, |
|
|
size_t |
alignment = alignof(T), |
|
|
bool |
upwards = true |
|
) |
| |
|
inlinestaticnoexcept |
Align pointer (upwards or downwards)
- Parameters
-
| address | - Address |
| alignment | - Alignment value. Must be a pointer of two (default is alignof(T)) |
| upwards | - Upwards flag (default is true) |
- Returns
- Aligned address
Definition at line 29 of file memory.inl.
◆ CryptoFill()
| void CppCommon::Memory::CryptoFill |
( |
void * |
buffer, |
|
|
size_t |
size |
|
) |
| |
|
static |
Fill the given memory buffer with cryptographic strong random bytes.
- Parameters
-
| buffer | - Memory buffer to fill |
| size | - Size of memory buffer in bytes |
Definition at line 136 of file memory.cpp.
◆ IsAligned()
template<typename T >
| bool CppCommon::Memory::IsAligned |
( |
const T * |
address, |
|
|
size_t |
alignment = alignof(T) |
|
) |
| |
|
inlinestaticnoexcept |
Is the given pointer aligned?
- Parameters
-
| address | - Address |
| alignment | - Alignment value. Must be a pointer of two (default is alignof(T)) |
- Returns
- 'true' if the given address is aligned, 'false' if the given address is not aligned
Definition at line 19 of file memory.inl.
◆ IsValidAlignment()
| bool CppCommon::Memory::IsValidAlignment |
( |
size_t |
alignment | ) |
|
|
inlinestaticnoexcept |
Is the given alignment valid?
- Parameters
-
| alignment | - Alignment value. Must be a power of two. |
- Returns
- 'true' if the given alignment is valid, 'false' if the given alignment is not valid
Definition at line 13 of file memory.inl.
◆ IsZero()
| bool CppCommon::Memory::IsZero |
( |
const void * |
buffer, |
|
|
size_t |
size |
|
) |
| |
|
staticnoexcept |
Is the given memory buffer filled with zeros?
- Parameters
-
| buffer | - Memory buffer |
| size | - Size of memory buffer in bytes |
- Returns
- 'true' if the given memory buffer is filled with zeros, 'false' if the memory buffer is not filled with zeros
Definition at line 95 of file memory.cpp.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ RamFree()
| int64_t CppCommon::Memory::RamFree |
( |
| ) |
|
|
static |
◆ RamTotal()
| int64_t CppCommon::Memory::RamTotal |
( |
| ) |
|
|
static |
◆ RandomFill()
| void CppCommon::Memory::RandomFill |
( |
void * |
buffer, |
|
|
size_t |
size |
|
) |
| |
|
static |
Fill the given memory buffer with random bytes.
- Parameters
-
| buffer | - Memory buffer to fill |
| size | - Size of memory buffer in bytes |
Definition at line 117 of file memory.cpp.
◆ ZeroFill()
| void CppCommon::Memory::ZeroFill |
( |
void * |
buffer, |
|
|
size_t |
size |
|
) |
| |
|
static |
Fill the given memory buffer with zeros.
- Parameters
-
| buffer | - Memory buffer to fill |
| size | - Size of memory buffer in bytes |
Definition at line 104 of file memory.cpp.
The documentation for this class was generated from the following files: