MCPcopy Create free account
hub / github.com/DanielChappuis/reactphysics3d / ~PoolAllocator

Method ~PoolAllocator

src/memory/PoolAllocator.cpp:82–97  ·  view source on GitHub ↗

Destructor

Source from the content-addressed store, hash-verified

80
81// Destructor
82PoolAllocator::~PoolAllocator() {
83
84 // Release the memory allocated for each block
85 for (uint i=0; i<mNbCurrentMemoryBlocks; i++) {
86 mBaseAllocator.release(mMemoryBlocks[i].memoryUnits, BLOCK_SIZE);
87 }
88
89 mBaseAllocator.release(mMemoryBlocks, mNbAllocatedMemoryBlocks * sizeof(MemoryBlock));
90
91#ifndef NDEBUG
92 // Check that the allocate() and release() methods have been called the same
93 // number of times to avoid memory leaks.
94 assert(mNbTimesAllocateMethodCalled == 0);
95#endif
96
97}
98
99// Allocate memory of a given size (in bytes) and return a pointer to the
100// allocated memory.

Callers

nothing calls this directly

Calls 1

releaseMethod · 0.45

Tested by

no test coverage detected