From 59714fb31d055f03e6e51dd575280f89d4538c22 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Wed, 1 Dec 2021 19:27:30 -0800 Subject: [PATCH] Removes MemoryDrillerBus Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Memory/BestFitExternalMapAllocator.cpp | 12 ----- .../AzCore/AzCore/Memory/MemoryDrillerBus.h | 52 ------------------- .../AzCore/AzCore/Memory/PoolAllocator.h | 3 -- .../AzCore/AzCore/Memory/SystemAllocator.cpp | 9 ---- Code/Framework/AzCore/AzCore/Task/TaskGraph.h | 1 + .../AzCore/AzCore/azcore_files.cmake | 1 - .../RPI.Public/Image/StreamingImageContext.h | 1 + 7 files changed, 2 insertions(+), 77 deletions(-) delete mode 100644 Code/Framework/AzCore/AzCore/Memory/MemoryDrillerBus.h diff --git a/Code/Framework/AzCore/AzCore/Memory/BestFitExternalMapAllocator.cpp b/Code/Framework/AzCore/AzCore/Memory/BestFitExternalMapAllocator.cpp index ca414df4b5..38474ff828 100644 --- a/Code/Framework/AzCore/AzCore/Memory/BestFitExternalMapAllocator.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/BestFitExternalMapAllocator.cpp @@ -10,7 +10,6 @@ #include #include -#include #include @@ -89,17 +88,6 @@ BestFitExternalMapAllocator::Allocate(size_type byteSize, size_type alignment, i byteSize = MemorySizeAdjustedUp(byteSize); BestFitExternalMapAllocator::pointer_type address = m_schema->Allocate(byteSize, alignment, flags); - if (address == nullptr) - { - if (!OnOutOfMemory(byteSize, alignment, flags, name, fileName, lineNum)) - { - if (GetRecords()) - { - EBUS_EVENT(Debug::MemoryDrillerBus, DumpAllAllocations); - } - } - } - AZ_Assert(address != nullptr, "BestFitExternalMapAllocator: Failed to allocate %d bytes aligned on %d (flags: 0x%08x) %s : %s (%d)!", byteSize, alignment, flags, name ? name : "(no name)", fileName ? fileName : "(no file name)", lineNum); AZ_MEMORY_PROFILE(ProfileAllocation(address, byteSize, alignment, name, fileName, lineNum, suppressStackRecord + 1)); diff --git a/Code/Framework/AzCore/AzCore/Memory/MemoryDrillerBus.h b/Code/Framework/AzCore/AzCore/Memory/MemoryDrillerBus.h deleted file mode 100644 index 43a31af006..0000000000 --- a/Code/Framework/AzCore/AzCore/Memory/MemoryDrillerBus.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#ifndef AZCORE_MEMORY_DRILLER_BUS_H -#define AZCORE_MEMORY_DRILLER_BUS_H 1 - -#include - -namespace AZ -{ - class IAllocator; - namespace Debug - { - //class AllocationRecords; - struct AllocationInfo; - - /** - * Memory allocations driller message. - * - * We use a driller bus so all messages are sending in exclusive matter no other driller messages - * can be triggered at that moment, so we already preserve the calling order. You can assume - * all access code in the driller framework in guarded. You can manually lock the driller mutex are you - * use by using \ref AZ::Debug::DrillerEBusMutex. - */ - class MemoryDrillerMessages - : public AZ::Debug::DrillerEBusTraits - { - public: - virtual ~MemoryDrillerMessages() {} - - /// Register allocation (with customizable tracking settings - TODO: we should centralize this settings and remove them from here) - virtual void RegisterAllocator(IAllocator* allocator) = 0; - virtual void UnregisterAllocator(IAllocator* allocator) = 0; - - virtual void RegisterAllocation(IAllocator* allocator, void* address, size_t byteSize, size_t alignment, const char* name, const char* fileName, int lineNum, unsigned int stackSuppressCount) = 0; - virtual void UnregisterAllocation(IAllocator* allocator, void* address, size_t byteSize, size_t alignment, AllocationInfo* info) = 0; - virtual void ReallocateAllocation(IAllocator* allocator, void* prevAddress, void* newAddress, size_t newByteSize, size_t newAlignment) = 0; - virtual void ResizeAllocation(IAllocator* allocator, void* address, size_t newSize) = 0; - - virtual void DumpAllAllocations() = 0; - }; - - typedef AZ::EBus MemoryDrillerBus; - } // namespace Debug -} // namespace AZ - -#endif // AZCORE_MEMORY_DRILLER_BUS_H -#pragma once diff --git a/Code/Framework/AzCore/AzCore/Memory/PoolAllocator.h b/Code/Framework/AzCore/AzCore/Memory/PoolAllocator.h index 72418b3d6e..a03f7b5b92 100644 --- a/Code/Framework/AzCore/AzCore/Memory/PoolAllocator.h +++ b/Code/Framework/AzCore/AzCore/Memory/PoolAllocator.h @@ -12,9 +12,6 @@ #include #include -#include - - namespace AZ { template diff --git a/Code/Framework/AzCore/AzCore/Memory/SystemAllocator.cpp b/Code/Framework/AzCore/AzCore/Memory/SystemAllocator.cpp index 8c84338fd0..ddcc046b8e 100644 --- a/Code/Framework/AzCore/AzCore/Memory/SystemAllocator.cpp +++ b/Code/Framework/AzCore/AzCore/Memory/SystemAllocator.cpp @@ -11,7 +11,6 @@ #include #include -#include #include @@ -248,14 +247,6 @@ SystemAllocator::Allocate(size_type byteSize, size_type alignment, int flags, co if (address == nullptr) { byteSize = MemorySizeAdjustedDown(byteSize); // restore original size - - if (!OnOutOfMemory(byteSize, alignment, flags, name, fileName, lineNum)) - { - if (GetRecords()) - { - EBUS_EVENT(Debug::MemoryDrillerBus, DumpAllAllocations); - } - } } AZ_Assert(address != nullptr, "SystemAllocator: Failed to allocate %d bytes aligned on %d (flags: 0x%08x) %s : %s (%d)!", byteSize, alignment, flags, name ? name : "(no name)", fileName ? fileName : "(no file name)", lineNum); diff --git a/Code/Framework/AzCore/AzCore/Task/TaskGraph.h b/Code/Framework/AzCore/AzCore/Task/TaskGraph.h index fa6f5dbe94..9878dc59c1 100644 --- a/Code/Framework/AzCore/AzCore/Task/TaskGraph.h +++ b/Code/Framework/AzCore/AzCore/Task/TaskGraph.h @@ -16,6 +16,7 @@ #include #include #include +#include namespace AZ { diff --git a/Code/Framework/AzCore/AzCore/azcore_files.cmake b/Code/Framework/AzCore/AzCore/azcore_files.cmake index 467c129c93..64562c560c 100644 --- a/Code/Framework/AzCore/AzCore/azcore_files.cmake +++ b/Code/Framework/AzCore/AzCore/azcore_files.cmake @@ -393,7 +393,6 @@ set(FILES Memory/Memory.h Memory/MemoryComponent.cpp Memory/MemoryComponent.h - Memory/MemoryDrillerBus.h Memory/nedmalloc.inl Memory/NewAndDelete.inl Memory/OSAllocator.cpp diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/Image/StreamingImageContext.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/Image/StreamingImageContext.h index ec12a14ecf..fe65831716 100644 --- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/Image/StreamingImageContext.h +++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/Image/StreamingImageContext.h @@ -11,6 +11,7 @@ #include #include #include +#include #include