Merge pull request #6390 from aws-lumberyard-dev/memory/overrideshim_removal

Memory/overrideshim removal
This commit is contained in:
Esteban Papp
2022-01-26 08:15:20 -08:00
committed by GitHub
63 changed files with 311 additions and 1231 deletions
+3 -25
View File
@@ -23,19 +23,9 @@ inline void* CryModuleMallocImpl(size_t size, const char* file, const int line)
#define CryModuleFree(ptr) CryModuleFreeImpl(ptr, __FILE__, __LINE__)
#define CryModuleMemalignFree(ptr) CryModuleFreeImpl(ptr, __FILE__, __LINE__)
inline void CryModuleFreeImpl(void* ptr, const char* file, const int line)
inline void CryModuleFreeImpl(void* ptr, const char*, const int)
{
AZ::IAllocator& allocator = AZ::AllocatorInstance<AZ::LegacyAllocator>::GetAllocator();
if (allocator.IsAllocationSourceChanged())
{
allocator.GetAllocationSource()->DeAllocate(ptr);
}
else
{
static_cast<AZ::LegacyAllocator&>(allocator).DeAllocate(ptr, file, line);
}
AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().DeAllocate(ptr, 0, 0);
}
#define CryModuleMemalign(size, alignment) CryModuleMemalignImpl(size, alignment, __FILE__, __LINE__)
@@ -79,17 +69,5 @@ inline void* CryModuleReallocAlignImpl(void* prev, size_t size, size_t alignment
}
#endif
AZ::IAllocator& allocator = AZ::AllocatorInstance<AZ::LegacyAllocator>::GetAllocator();
void *ptr;
if (allocator.IsAllocationSourceChanged())
{
ptr = allocator.GetAllocationSource()->ReAllocate(prev, size, 0);
}
else
{
ptr = static_cast<AZ::LegacyAllocator&>(allocator).ReAllocate(prev, size, 0, file, line);
}
return ptr;
return AZ::AllocatorInstance<AZ::LegacyAllocator>::Get().ReAllocate(prev, size, 0);
}