1#ifndef YAZE_APP_CORE_PLATFORM_MEMORY_TRACKER_H
2#define YAZE_APP_CORE_PLATFORM_MEMORY_TRACKER_H
9#include <unordered_map>
22 std::lock_guard<std::mutex> lock(
mutex_);
28 std::lock_guard<std::mutex> lock(
mutex_);
37 std::lock_guard<std::mutex> lock(
mutex_);
42 std::lock_guard<std::mutex> lock(
mutex_);
43 SDL_Log(
"Memory allocations: %zu bytes in %zu allocations",
46 std::unordered_map<std::string, size_t> type_counts;
48 type_counts[pair.second.type] += pair.second.size;
51 for (
const auto& pair : type_counts) {
52 SDL_Log(
" %s: %zu bytes", pair.first.c_str(), pair.second);
58 std::lock_guard<std::mutex> lock(
mutex_);
static MemoryTracker & GetInstance()
void TrackDeallocation(const void *ptr)
bool IsFreed(const void *ptr) const
size_t GetTotalAllocated() const
void DumpAllocations() const
void TrackAllocation(const void *ptr, size_t size, const char *type)
std::unordered_map< const void *, AllocationInfo > allocations_
Main namespace for the application.