Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
MallocTBB.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
6#include "HAL/MemoryBase.h"
7#include "HAL/PlatformMemory.h"
8
9#define TBBMALLOC_ENABLED PLATFORM_SUPPORTS_TBB && TBB_ALLOCATOR_ALLOWED
10
12
13/**
14 * TBB 64-bit scalable memory allocator.
15 */
16class FMallocTBB final
17 : public FMalloc
18{
19public:
20 // FMalloc interface.
21
22 virtual void* Malloc(SIZE_T Size, uint32 Alignment) override;
23 virtual void* TryMalloc(SIZE_T Size, uint32 Alignment) override;
24 virtual void* Realloc(void* Ptr, SIZE_T NewSize, uint32 Alignment) override;
25 virtual void* TryRealloc(void* Ptr, SIZE_T NewSize, uint32 Alignment) override;
26 virtual void Free( void* Ptr ) override;
27 virtual bool GetAllocationSize( void *Original, SIZE_T &SizeOut ) override;
28 virtual void Trim(bool bTrimThreadCaches) override;
29
30 virtual bool IsInternallyThreadSafe( ) const override
31 {
32 return true;
33 }
34
35 virtual const TCHAR* GetDescriptiveName( ) override
36 {
37 return TEXT("TBB");
38 }
39
40protected:
41
42 void OutOfMemory( uint64 Size, uint32 Alignment )
43 {
44 // this is expected not to return
46 }
47};
48
49#endif // TBBMALLOC_ENABLED
#define TBBMALLOC_ENABLED
Definition MallocTBB.h:9
#define TEXT(x)
Definition Platform.h:1108
#define PLATFORM_SUPPORTS_TBB
Definition Platform.h:377
#define TBB_ALLOCATOR_ALLOWED
FWindowsPlatformMemory FPlatformMemory
static void OnOutOfMemory(uint64 Size, uint32 Alignment)