diff --git a/Minecraft-Community-Edition/Core/eastl_allocator.cpp b/Minecraft-Community-Edition/Core/eastl_allocator.cpp new file mode 100644 index 0000000..89e55b6 --- /dev/null +++ b/Minecraft-Community-Edition/Core/eastl_allocator.cpp @@ -0,0 +1,32 @@ +#include +#include +#include + +// Delete corresponding to: +// void* operator new[](size_t size, const char* name, int flags, unsigned debugFlags, const char* file, int line) +void __cdecl operator delete[](void* p, const char* name, int flags, unsigned debugFlags, const char* file, int line) noexcept { + delete[] static_cast(p); +} + +// Delete corresponding to: +// void* operator new[](uint64_t size, uint64_t alignment, uint64_t offset, const char* pName, int flags, unsigned debugFlags, const char* file, int line) +void __cdecl operator delete[](void* p, unsigned __int64 size, unsigned __int64 alignment, unsigned __int64 offset, const char* pName, int flags, unsigned debugFlags, const char* file, int line) noexcept { + delete[] static_cast(p); +} + +// You should also provide normal delete[] to match standard usage +void __cdecl operator delete[](void* p) noexcept { + if (p != nullptr) { + std::free(p); + p = nullptr; + } +} + +void* __cdecl operator new[](size_t size, const char* name, int flags, unsigned debugFlags, const char* file, int line) { + return new uint8_t[size]; +} + +void* __cdecl operator new[](unsigned __int64 size, unsigned __int64 alignment, unsigned __int64 offset, char const* pName, int flags, unsigned int debugFlags, char const* file, int line) { + + return new uint8_t[size]; +} \ No newline at end of file