6 #ifndef EASTL_ALLOCATOR_MALLOC_H
7 #define EASTL_ALLOCATOR_MALLOC_H
10 #include <EABase/eahave.h>
11 #include <EASTL/allocator.h>
28 #if !defined EASTL_ALIGNED_MALLOC_AVAILABLE
29 #if defined(EA_PLATFORM_POSIX) && !defined(EA_PLATFORM_APPLE)
33 #define EASTL_ALIGNED_MALLOC_AVAILABLE 1
35 #if EA_HAS_INCLUDE_AVAILABLE
36 #if EA_HAS_INCLUDE(<malloc/malloc.h>)
37 #include <malloc/malloc.h>
38 #elif EA_HAS_INCLUDE(<malloc.h>)
41 #elif defined(EA_PLATFORM_BSD)
42 #include <malloc/malloc.h>
43 #elif defined(__clang__)
44 #if __has_include(<malloc/malloc.h>)
45 #include <malloc/malloc.h>
46 #elif __has_include(<malloc.h>)
53 #define EASTL_ALIGNED_MALLOC_AVAILABLE 0
91 void* allocate(
size_t n,
int = 0)
94 void* allocate(
size_t n,
size_t alignment,
size_t alignmentOffset,
int = 0)
96 #if EASTL_ALIGNED_MALLOC_AVAILABLE
97 if((alignmentOffset % alignment) == 0)
98 return memalign(alignment, n);
100 if((alignment <= EASTL_SYSTEM_ALLOCATOR_MIN_ALIGNMENT) && ((alignmentOffset % alignment) == 0))
106 void deallocate(
void* p,
size_t )
109 const char* get_name()
const
110 {
return "allocator_malloc"; }
112 void set_name(
const char*)
Definition: allocator_malloc.h:71
EA Standard Template Library.
Definition: algorithm.h:288