MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-ValidationLayers / vvl_aligned_malloc

Function vvl_aligned_malloc

layers/profiling/profiling.cpp:80–85  ·  view source on GitHub ↗

TODO - Need to understand why on Linux sometimes calling aligned_alloc causes corruption

Source from the content-addressed store, hash-verified

78#else
79// TODO - Need to understand why on Linux sometimes calling aligned_alloc causes corruption
80void* vvl_aligned_malloc(std::size_t size, std::size_t al) {
81 void* mem = malloc(size + al + sizeof(void*));
82 void** ptr = (void**)((uintptr_t)((uintptr_t)mem + al + sizeof(void*)) & ~(al - 1));
83 ptr[-1] = mem;
84 return ptr;
85}
86
87void vvl_aligned_free(void* ptr) { free(((void**)ptr)[-1]); }
88#endif

Callers 2

operator newFunction · 0.85
operator new[]Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected