ladivic
|
Memory management utilities for dynamic allocation and deallocation. More...
Go to the source code of this file.
Functions | |
template<typename T > | |
T * | ldvc_malloc (usize size) |
Allocates memory for an array of elements. | |
template<typename T > | |
void | ldvc_free (T *object) |
Deallocates memory previously allocated by ldvc_malloc or similar functions. | |
template<typename T > | |
T * | ldvc_realloc (T *ptr, usize size) |
Reallocates memory for an array of elements. | |
template<typename T > | |
T * | ldvc_calloc (usize num) |
Allocates and initializes memory for an array of elements. | |
Variables | |
std::mutex | ldvc_mem_mutx |
Mutex for thread-safe memory management. | |
Memory management utilities for dynamic allocation and deallocation.
This header file provides functions for dynamic memory allocation and deallocation, including allocation, reallocation, and deallocation of memory blocks. Thread safety is ensured during these operations using a mutex.
Definition in file ldvc_mem.hpp.
Allocates and initializes memory for an array of elements.
This function allocates memory for an array of elements of type T with the specified size and initializes all elements to zero.
T | The type of elements to allocate memory for. |
num | The number of elements to allocate memory for. |
Definition at line 133 of file ldvc_mem.hpp.
Deallocates memory previously allocated by ldvc_malloc or similar functions.
This function deallocates memory previously allocated by ldvc_malloc or similar functions.
T | The type of elements in the memory block to deallocate. |
object | A pointer to the memory block to deallocate. |
Definition at line 84 of file ldvc_mem.hpp.
Referenced by ldvc_realloc().
T * ldvc_malloc | ( | usize | size | ) |
Allocates memory for an array of elements.
This function allocates memory for an array of elements of type T with the specified size.
T | The type of elements to allocate memory for. |
size | The number of elements to allocate memory for. |
Definition at line 61 of file ldvc_mem.hpp.
Referenced by ldvc_calloc(), and ldvc_realloc().
Reallocates memory for an array of elements.
This function reallocates memory for an array of elements of type T with the specified size.
T | The type of elements to reallocate memory for. |
ptr | A pointer to the memory block to reallocate. |
size | The new number of elements to allocate memory for. |
Definition at line 106 of file ldvc_mem.hpp.
std::mutex ldvc_mem_mutx |
Mutex for thread-safe memory management.
Definition at line 44 of file ldvc_mem.hpp.
Referenced by ldvc_free(), and ldvc_malloc().