text
stringlengths
0
2.2M
alignment = alignment < sizeof( void *) ? sizeof( void *) : alignment;
posix_memalign(&p, alignment, size);
return p;
#endif
}
void PlatformFree(void* p)
{
#ifdef EA_PLATFORM_MICROSOFT
_aligned_free(p);
#else
free(p);
#endif
}
void* InternalMalloc(size_t size)
{
void* mem = nullptr;
auto& allocator = EA::Allocator::EASTLTest_GetGeneralAllocator();
#ifdef EA_DEBUG
mem = allocator.MallocDebug(size, 0, 0, gUnattributedNewTag, UNATTRIBUTED_NEW_FILE, UNATTRIBUTED_NEW_LINE);
#else
mem = allocator.Malloc(size);
#endif
if(mem == nullptr)
mem = PlatformMalloc(size);
return mem;
}
void* InternalMalloc(size_t size, const char* name, int flags, unsigned debugFlags, const char* file, int line)
{
void* mem = nullptr;
auto& allocator = EA::Allocator::EASTLTest_GetGeneralAllocator();
#ifdef EA_DEBUG
mem = allocator.MallocDebug(size, flags, debugFlags, name, file, line);
#else
mem = allocator.Malloc(size, flags);
EA_UNUSED(debugFlags);
EA_UNUSED(file);
EA_UNUSED(line);
EA_UNUSED(name);
#endif
if(mem == nullptr)
mem = PlatformMalloc(size);
return mem;
}
void* InternalMalloc(size_t size, size_t alignment, const char* name, int flags, unsigned debugFlags, const char* file, int line)
{
void* mem = nullptr;
auto& allocator = EA::Allocator::EASTLTest_GetGeneralAllocator();
#ifdef EA_DEBUG
mem = allocator.MallocAlignedDebug(size, alignment, 0, flags, debugFlags, name, file, line);
#else
mem = allocator.MallocAligned(size, alignment, flags);
EA_UNUSED(debugFlags);
EA_UNUSED(file);
EA_UNUSED(line);
EA_UNUSED(name);
#endif
if(mem == nullptr)
mem = PlatformMalloc(size, alignment);
return mem;
}
void* InternalMalloc(size_t size, size_t alignment)
{
void* mem = nullptr;
auto& allocator = EA::Allocator::EASTLTest_GetGeneralAllocator();
#ifdef EA_DEBUG
mem = allocator.MallocAlignedDebug(size, alignment, 0, 0, 0, gUnattributedNewTag, UNATTRIBUTED_NEW_FILE, UNATTRIBUTED_NEW_LINE);
#else
mem = allocator.MallocAligned(size, alignment);
#endif
if(mem == nullptr)
mem = PlatformMalloc(size, alignment);
return mem;
}
void InternalFree(void* p)
{
auto& allocator = EA::Allocator::EASTLTest_GetGeneralAllocator();
if(allocator.ValidateAddress(p, EA::Allocator::GeneralAllocator::kAddressTypeOwned) == p)