MCPcopy Create free account
hub / github.com/DanielChappuis/reactphysics3d / removeFromFreeUnits

Method removeFromFreeUnits

src/memory/HeapAllocator.cpp:281–294  ·  view source on GitHub ↗

Remove the unit from the linked-list of free units

Source from the content-addressed store, hash-verified

279
280// Remove the unit from the linked-list of free units
281void HeapAllocator::removeFromFreeUnits(MemoryUnitHeader* unit) {
282
283 if (unit->previousFreeUnit != nullptr) {
284 unit->previousFreeUnit->nextFreeUnit = unit->nextFreeUnit;
285 }
286 if (unit->nextFreeUnit != nullptr) {
287 unit->nextFreeUnit->previousFreeUnit = unit->previousFreeUnit;
288 }
289 if (unit == mFreeUnits) {
290 mFreeUnits = unit->nextFreeUnit;
291 }
292 unit->nextFreeUnit = nullptr;
293 unit->previousFreeUnit = nullptr;
294}
295
296// Merge two contiguous memory units that are not allocated.
297/// Memory unit 2 will be merged into memory unit 1 and memory unit 2 will be removed

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected