1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
7 class HostAllocator final
10 static HostAllocator s_hostAllocator;
17 void* Alloc(size_t size);
19 void* ArrayAlloc(size_t elemSize, size_t numElems);
23 static HostAllocator* getHostAllocator();
26 // Global operator new overloads that work with HostAllocator
28 inline void* __cdecl operator new(size_t n, HostAllocator* alloc)
30 return alloc->Alloc(n);
33 inline void* __cdecl operator new[](size_t n, HostAllocator* alloc)
35 return alloc->Alloc(n);