CookMem 1.4.0
A C++ memory context / allocator
Loading...
Searching...
No Matches
cookmem::MemLogger Class Referenceabstract

#include <logger.h>

Public Member Functions

virtual void logGetSegment (void *segment, std::size_t segmentSize)=0
 
virtual void logFreeSegment (void *segment, std::size_t segmentSize)=0
 
virtual void logTrimEmptySegments ()=0
 
virtual void logAllocation (void *userPtr, std::size_t userSize, MemAllocType_et allocType)=0
 
virtual void logReallocation (void *userPtr, std::size_t oldUserSize, std::size_t newUserSize)=0
 
virtual void logDeallocation (void *userPtr, std::size_t userSize)=0
 
virtual void logError (void *userPtr, MemError_et error, const char *file=__FILE__, int line=__LINE__)=0
 

Detailed Description

A MemLogger logs memory allocation, deallocation, and errors.

This class here is merely used to define the functions needed to implement a MemLogger.

Member Function Documentation

◆ logAllocation()

virtual void cookmem::MemLogger::logAllocation ( void *  userPtr,
std::size_t  userSize,
MemAllocType_et  allocType 
)
pure virtual

Log the memory allocation.

Parameters
userPtrthe user pointer allocated.
userSizethe user requested size.
allocTypethe type of the allocation.

◆ logDeallocation()

virtual void cookmem::MemLogger::logDeallocation ( void *  userPtr,
std::size_t  userSize 
)
pure virtual

Log the memory deallocation.

Parameters
userPtrthe user pointer allocated.
userSizethe user requested size.

◆ logError()

virtual void cookmem::MemLogger::logError ( void *  userPtr,
MemError_et  error,
const char *  file = __FILE__,
int  line = __LINE__ 
)
pure virtual

Log the memory corruption.

Parameters
userPtrthe user pointer that had the memory corruption.
errorthe type of the error encountered.
filethe source file where the error was detected.
linethe line number where the error was detected.

◆ logFreeSegment()

virtual void cookmem::MemLogger::logFreeSegment ( void *  segment,
std::size_t  segmentSize 
)
pure virtual

Log the memory segment release.

Parameters
segmentthe segment released.
segmentSizethe segment size.

◆ logGetSegment()

virtual void cookmem::MemLogger::logGetSegment ( void *  segment,
std::size_t  segmentSize 
)
pure virtual

Log the memory segment allocation.

Parameters
segmentthe segment obtained.
segmentSizethe segment size.

◆ logReallocation()

virtual void cookmem::MemLogger::logReallocation ( void *  userPtr,
std::size_t  oldUserSize,
std::size_t  newUserSize 
)
pure virtual

Log the memory reallocation. This is only called when the new size is smaller than the original size.

Parameters
userPtrthe user pointer allocated.
oldUserSizethe old user size.
newUserSizethe new user size.

◆ logTrimEmptySegments()

virtual void cookmem::MemLogger::logTrimEmptySegments ( )
pure virtual

Log a pool empty-segment trimming pass.


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