unilink  0.4.3
A simple C++ library for unified async communication
unilink::memory::MemoryTracker Class Reference

Memory allocation tracker for debugging and monitoring. More...

#include <memory_tracker.hpp>

Classes

struct  AllocationInfo
 
struct  MemoryStats
 

Public Member Functions

void track_allocation (void *ptr, size_t size, const char *file, int line, const char *function)
 
void track_deallocation (void *ptr)
 
MemoryStats get_stats () const
 
std::vector< AllocationInfoget_current_allocations () const
 
std::vector< AllocationInfoget_leaked_allocations () const
 
void enable_tracking (bool enable=true)
 
void disable_tracking ()
 
bool is_tracking_enabled () const
 
void clear_tracking_data ()
 
void print_memory_report () const
 
void print_leak_report () const
 
void log_memory_report () const
 
void log_leak_report () const
 

Static Public Member Functions

static MemoryTrackerinstance ()
 

Detailed Description

Memory allocation tracker for debugging and monitoring.

Tracks memory allocations and deallocations to detect leaks, monitor usage patterns, and provide debugging information.

Definition at line 38 of file memory_tracker.hpp.

Member Function Documentation

◆ clear_tracking_data()

void unilink::memory::MemoryTracker::clear_tracking_data ( )

Definition at line 110 of file memory_tracker.cc.

◆ disable_tracking()

void unilink::memory::MemoryTracker::disable_tracking ( )

Definition at line 106 of file memory_tracker.cc.

◆ enable_tracking()

void unilink::memory::MemoryTracker::enable_tracking ( bool  enable = true)

Definition at line 104 of file memory_tracker.cc.

◆ get_current_allocations()

std::vector< MemoryTracker::AllocationInfo > unilink::memory::MemoryTracker::get_current_allocations ( ) const

Definition at line 87 of file memory_tracker.cc.

◆ get_leaked_allocations()

std::vector< MemoryTracker::AllocationInfo > unilink::memory::MemoryTracker::get_leaked_allocations ( ) const

Definition at line 100 of file memory_tracker.cc.

◆ get_stats()

MemoryTracker::MemoryStats unilink::memory::MemoryTracker::get_stats ( ) const

Definition at line 85 of file memory_tracker.cc.

◆ instance()

MemoryTracker & unilink::memory::MemoryTracker::instance ( )
static

Definition at line 28 of file memory_tracker.cc.

◆ is_tracking_enabled()

bool unilink::memory::MemoryTracker::is_tracking_enabled ( ) const

Definition at line 108 of file memory_tracker.cc.

◆ log_leak_report()

void unilink::memory::MemoryTracker::log_leak_report ( ) const

Definition at line 199 of file memory_tracker.cc.

◆ log_memory_report()

void unilink::memory::MemoryTracker::log_memory_report ( ) const

Definition at line 170 of file memory_tracker.cc.

◆ print_leak_report()

void unilink::memory::MemoryTracker::print_leak_report ( ) const

Definition at line 149 of file memory_tracker.cc.

◆ print_memory_report()

void unilink::memory::MemoryTracker::print_memory_report ( ) const

Definition at line 125 of file memory_tracker.cc.

◆ track_allocation()

void unilink::memory::MemoryTracker::track_allocation ( void *  ptr,
size_t  size,
const char *  file,
int  line,
const char *  function 
)

Definition at line 33 of file memory_tracker.cc.

◆ track_deallocation()

void unilink::memory::MemoryTracker::track_deallocation ( void *  ptr)

Definition at line 65 of file memory_tracker.cc.


The documentation for this class was generated from the following files: