|
CookMem 1.4.0
A C++ memory context / allocator
|
#include <logger.h>
Public Member Functions | |
| void | logTrimEmptySegments () |
| void | logGetSegment (void *segment, std::size_t segmentSize) |
| void | logFreeSegment (void *segment, std::size_t segmentSize) |
| void | logAllocation (void *userPtr, std::size_t userSize, MemAllocType_et allocType) |
| void | logReallocation (void *userPtr, std::size_t oldUserSize, std::size_t newUserSize) |
| void | logDeallocation (void *userPtr, std::size_t userSize) |
| void | logError (void *, MemError_et error, const char *file=__FILE__, int line=__LINE__) |
| MemStatistics & | getStats () |
| const MemStatistics & | getStats () const |
A MemLogger that tracks allocation and segment usage statistics.
This class implements the interface of MemLogger without explicitly inheriting from it. This is to avoid the overhead of virtual function calls and allows inlining of the functions.
|
inline |
Get the statistics.
|
inline |
Get the statistics.
|
inline |
Log the memory allocation.
| userPtr | the user pointer allocated. |
| userSize | the user requested size. |
| allocType | the type of the allocation. |
Log the memory deallocation.
| userPtr | the user pointer allocated. |
| userSize | the user requested size. |
|
inline |
Report a memory error by throwing an exception.
| error | the type of the error encountered. |
| file | the source file where the error was detected. |
| line | the line number where the error was detected. |
| Exception | always. |
Log the memory segment release.
| segment | the segment released. |
| segmentSize | the segment size. |
Log the memory segment allocation.
| segment | the segment obtained. |
| segmentSize | the segment size. |
|
inline |
Log the memory reallocation. This is only called when the new size is smaller than the original size.
| userPtr | the user pointer allocated. |
| oldUserSize | the old user size. |
| newUserSize | the new user size. |
|
inline |
Log a pool empty-segment trimming pass.