Switch to the high pref heap allocator, roll back pool interface changes
Signed-off-by: Nicholas Van Sickle <nvsickle@amazon.com>
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <AzCore/DOM/DomVisitor.h>
|
||||
#include <AzCore/Memory/Memory.h>
|
||||
#include <AzCore/Memory/PoolAllocator.h>
|
||||
#include <AzCore/Memory/HphaSchema.h>
|
||||
#include <AzCore/std/containers/stack.h>
|
||||
#include <AzCore/std/containers/unordered_map.h>
|
||||
#include <AzCore/std/containers/variant.h>
|
||||
@@ -36,22 +37,20 @@ namespace AZ::Dom
|
||||
OpaqueType = 8,
|
||||
};
|
||||
|
||||
class ValueAllocator final : public ThreadPoolBase<ValueAllocator, false>
|
||||
class ValueAllocator final : public SimpleSchemaAllocator<AZ::HphaSchema, AZ::HphaSchema::Descriptor, false, false>
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(ValueAllocator, SystemAllocator, 0);
|
||||
AZ_TYPE_INFO(ValueAllocator, "{5BC8B389-72C7-459E-B502-12E74D61869F}");
|
||||
|
||||
using Base = SimpleSchemaAllocator<AZ::HphaSchema, AZ::HphaSchema::Descriptor, false, false>;
|
||||
|
||||
ValueAllocator()
|
||||
: ThreadPoolBase<ValueAllocator, false>("DomValueAllocator", "Allocator for AZ::Dom::Value")
|
||||
: Base("DomValueAllocator", "Allocator for AZ::Dom::Value")
|
||||
{
|
||||
DisableOverriding();
|
||||
}
|
||||
};
|
||||
|
||||
// class ValueAllocator : public Internal::PoolAllocatorHelper<PoolScema
|
||||
|
||||
// using ValueAllocator = ThreadPoolAllocator;
|
||||
|
||||
class Value;
|
||||
|
||||
class Array
|
||||
|
||||
@@ -25,12 +25,12 @@ namespace AZ
|
||||
* Template you can use to create your own thread pool allocators, as you can't inherit from ThreadPoolAllocator.
|
||||
* This is the case because we use tread local storage and we need separate "static" instance for each allocator.
|
||||
*/
|
||||
template<class Schema, bool ProfileAllocations>
|
||||
template<class Schema>
|
||||
class PoolAllocatorHelper
|
||||
: public SimpleSchemaAllocator<Schema, typename Schema::Descriptor, ProfileAllocations, /* ReportOutOfMemory */ false>
|
||||
: public SimpleSchemaAllocator<Schema, typename Schema::Descriptor, /* ProfileAllocations */ true, /* ReportOutOfMemory */ false>
|
||||
{
|
||||
public:
|
||||
using Base = SimpleSchemaAllocator<Schema, typename Schema::Descriptor, ProfileAllocations, false>;
|
||||
using Base = SimpleSchemaAllocator<Schema, typename Schema::Descriptor, true, false>;
|
||||
using pointer_type = typename Base::pointer_type;
|
||||
using size_type = typename Base::size_type;
|
||||
using difference_type = typename Base::difference_type;
|
||||
@@ -140,13 +140,13 @@ namespace AZ
|
||||
* use PoolAllocatorThreadSafe or do the sync yourself.
|
||||
*/
|
||||
class PoolAllocator
|
||||
: public Internal::PoolAllocatorHelper<PoolSchema, /*ProfileAllocations*/ true>
|
||||
: public Internal::PoolAllocatorHelper<PoolSchema>
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(PoolAllocator, SystemAllocator, 0);
|
||||
AZ_TYPE_INFO(PoolAllocator, "{D3DC61AF-0949-4BFA-87E0-62FA03A4C025}");
|
||||
|
||||
using Base = Internal::PoolAllocatorHelper<PoolSchema, true>;
|
||||
using Base = Internal::PoolAllocatorHelper<PoolSchema>;
|
||||
|
||||
PoolAllocator(const char* name = "PoolAllocator", const char* desc = "Generic pool allocator for small objects")
|
||||
: Base(name, desc)
|
||||
@@ -154,21 +154,21 @@ namespace AZ
|
||||
}
|
||||
};
|
||||
|
||||
template<class Allocator, bool ProfileAllocations = true>
|
||||
using ThreadPoolBase = Internal::PoolAllocatorHelper<ThreadPoolSchemaHelper<Allocator>, ProfileAllocations >;
|
||||
template<class Allocator>
|
||||
using ThreadPoolBase = Internal::PoolAllocatorHelper<ThreadPoolSchemaHelper<Allocator> >;
|
||||
|
||||
/*!
|
||||
* Thread safe pool allocator. If you want to create your own thread pool heap,
|
||||
* inherit from ThreadPoolBase, as we need unique static variable for allocator type.
|
||||
*/
|
||||
class ThreadPoolAllocator final
|
||||
: public ThreadPoolBase<ThreadPoolAllocator, /*ProfileAllocations*/ true>
|
||||
: public ThreadPoolBase<ThreadPoolAllocator>
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(ThreadPoolAllocator, SystemAllocator, 0);
|
||||
AZ_TYPE_INFO(ThreadPoolAllocator, "{05B4857F-CD06-4942-99FD-CA6A7BAE855A}");
|
||||
|
||||
using Base = ThreadPoolBase<ThreadPoolAllocator, true>;
|
||||
using Base = ThreadPoolBase<ThreadPoolAllocator>;
|
||||
|
||||
ThreadPoolAllocator()
|
||||
: Base("PoolAllocatorThreadSafe", "Generic thread safe pool allocator for small objects")
|
||||
|
||||
Reference in New Issue
Block a user