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

Method SingleFrameAllocator

src/memory/SingleFrameAllocator.cpp:35–48  ·  view source on GitHub ↗

Constructor

Source from the content-addressed store, hash-verified

33
34// Constructor
35SingleFrameAllocator::SingleFrameAllocator(MemoryAllocator& baseAllocator) : mBaseAllocator(baseAllocator),
36 mTotalSizeBytes(INIT_SINGLE_FRAME_ALLOCATOR_NB_BYTES),
37 mCurrentOffset(0), mNeedToAllocatedMore(false) {
38
39 // Allocate a whole block of memory at the beginning
40 void* allocatedMemory = mBaseAllocator.allocate(mTotalSizeBytes);
41
42 assert(allocatedMemory != nullptr);
43
44 // Check that allocated memory is 16-bytes aligned
45 assert(reinterpret_cast<uintptr_t>(allocatedMemory) % GLOBAL_ALIGNMENT == 0);
46
47 mMemoryBufferStart = static_cast<char*>(allocatedMemory);
48}
49
50// Destructor
51SingleFrameAllocator::~SingleFrameAllocator() {

Callers

nothing calls this directly

Calls 1

allocateMethod · 0.45

Tested by

no test coverage detected