Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
MallocAnsi.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/UnrealMemory.h"
8
9void* AnsiMalloc(SIZE_T Size, uint32 Alignment);
10void* AnsiRealloc(void* Ptr, SIZE_T NewSize, uint32 Alignment);
11void AnsiFree(void* Ptr);
12
13//
14// ANSI C memory allocator.
15//
16class FMallocAnsi final
17 : public FMalloc
18{
19
20public:
21 /**
22 * Constructor enabling low fragmentation heap on platforms supporting it.
23 */
25
26 // FMalloc interface.
27 virtual void* Malloc( SIZE_T Size, uint32 Alignment ) override;
28
29 virtual void* TryMalloc(SIZE_T Size, uint32 Alignment) override;
30
31 virtual void* Realloc( void* Ptr, SIZE_T NewSize, uint32 Alignment ) override;
32
33 virtual void* TryRealloc(void* Ptr, SIZE_T NewSize, uint32 Alignment) override;
34
35 virtual void Free( void* Ptr ) override;
36
37 virtual bool GetAllocationSize(void *Original, SIZE_T &SizeOut) override;
38
39 /**
40 * Returns if the allocator is guaranteed to be thread-safe and therefore
41 * doesn't need a unnecessary thread-safety wrapper around it.
42 *
43 * @return true as we're using system allocator
44 */
45 virtual bool IsInternallyThreadSafe() const override;
46
47 /**
48 * Validates the allocator's heap
49 */
50 virtual bool ValidateHeap() override;
51
52 virtual const TCHAR* GetDescriptiveName() override { return TEXT("ANSI"); }
53};
void AnsiFree(void *Ptr)
void * AnsiRealloc(void *Ptr, SIZE_T NewSize, uint32 Alignment)
void * AnsiMalloc(SIZE_T Size, uint32 Alignment)
#define TEXT(x)
Definition Platform.h:1108
virtual void * TryRealloc(void *Ptr, SIZE_T NewSize, uint32 Alignment) override
virtual bool IsInternallyThreadSafe() const override
virtual bool ValidateHeap() override
virtual void * Malloc(SIZE_T Size, uint32 Alignment) override
virtual void * TryMalloc(SIZE_T Size, uint32 Alignment) override
virtual void Free(void *Ptr) override
virtual void * Realloc(void *Ptr, SIZE_T NewSize, uint32 Alignment) override
virtual bool GetAllocationSize(void *Original, SIZE_T &SizeOut) override
virtual const TCHAR * GetDescriptiveName() override
Definition MallocAnsi.h:52