MCPcopy Create free account
hub / github.com/cpputest/cpputest / AccountingTestMemoryAllocator

Class AccountingTestMemoryAllocator

include/CppUTest/TestMemoryAllocator.h:206–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204struct AccountingTestMemoryAllocatorMemoryNode;
205
206class AccountingTestMemoryAllocator : public TestMemoryAllocator
207{
208public:
209 AccountingTestMemoryAllocator(MemoryAccountant& accountant, TestMemoryAllocator* originalAllocator);
210 virtual ~AccountingTestMemoryAllocator() _destructor_override;
211
212 virtual char* alloc_memory(size_t size, const char* file, size_t line) _override;
213 virtual void free_memory(char* memory, size_t size, const char* file, size_t line) _override;
214
215 virtual TestMemoryAllocator* actualAllocator() _override;
216 TestMemoryAllocator* originalAllocator();
217
218 virtual const char* alloc_name() const _override;
219 virtual const char* free_name() const _override;
220private:
221
222 void addMemoryToMemoryTrackingToKeepTrackOfSize(char* memory, size_t size);
223 size_t removeMemoryFromTrackingAndReturnAllocatedSize(char* memory);
224
225 size_t removeNextNodeAndReturnSize(AccountingTestMemoryAllocatorMemoryNode* node);
226 size_t removeHeadAndReturnSize();
227
228 MemoryAccountant& accountant_;
229 TestMemoryAllocator* originalAllocator_;
230 AccountingTestMemoryAllocatorMemoryNode* head_;
231};
232
233class GlobalMemoryAccountant
234{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected