![]() |
Raven Engine v0.1
|
#include "Raven/Core/Logging.h"#include "Raven/Core/Types.h"#include <cstdlib>#include <iostream>#include <mutex>#include <unordered_map>#include <new>#include <string>Classes | |
| struct | Raven::MemoryTracker::AllocationInfo |
| Struct to hold memory allocation information. More... | |
Namespaces | |
| namespace | Raven |
| namespace | Raven::MemoryTracker |
Macros | |
| #define | rnew new (__FUNCTION__) |
| Macro for memory allocation with tracking. | |
| #define | rdelete(ptr) |
| Macro for memory deallocation with tracking. | |
| #define | rdelete_array(ptr) |
| Macro for array memory deallocation with tracking. | |
Functions | |
| void | Raven::MemoryTracker::AddAllocation (void *ptr, usize size, const char *function) |
| Mutex for thread-safety when accessing the allocation map. | |
| void | Raven::MemoryTracker::RemoveAllocation (void *ptr) |
| Remove a memory allocation from the tracker. | |
| void | Raven::MemoryTracker::DumpLeaks () |
| Dump memory leaks, if any. | |
| void * | operator new (size_t size, const char *function) |
| Overload for new operator with function tracking. | |
| void * | operator new[] (size_t size, const char *function) |
| Overload for new[] operator with function tracking. | |
| void | operator delete (void *ptr, const char *) noexcept |
| Overload for delete operator with function tracking. | |
| void | operator delete[] (void *ptr, const char *) noexcept |
| Overload for delete[] operator with function tracking. | |
Variables | |
| std::unordered_map< void *, AllocationInfo > | Raven::MemoryTracker::s_Allocations |
| std::mutex | Raven::MemoryTracker::s_Mutex |
| Global map tracking allocations. | |
| #define rdelete | ( | ptr | ) |
Macro for memory deallocation with tracking.
This macro ensures memory is properly tracked when being deallocated.
| ptr | Pointer to the memory to be freed. |
| #define rdelete_array | ( | ptr | ) |
Macro for array memory deallocation with tracking.
This macro ensures memory for arrays is properly tracked when being deallocated.
| ptr | Pointer to the array of memory to be freed. |
| #define rnew new (__FUNCTION__) |
Macro for memory allocation with tracking.
This macro allows for allocation with the tracking of the calling function.
|
inlinenoexcept |
Overload for delete operator with function tracking.
Frees memory and removes the allocation from the tracker.
| ptr | Pointer to the memory to be freed. |
|
inlinenoexcept |
Overload for delete[] operator with function tracking.
Frees an array of memory and removes the allocation from the tracker.
| ptr | Pointer to the array of memory to be freed. |
|
inline |
Overload for new operator with function tracking.
Allocates memory and adds the allocation to the tracker, including the function where the allocation was made.
| size | Size of the memory to allocate. |
| function | The function where the allocation is taking place. |
|
inline |
Overload for new[] operator with function tracking.
Allocates an array of memory and adds the allocation to the tracker, including the function where the allocation was made.
| size | Size of the memory to allocate. |
| function | The function where the allocation is taking place. |