Memory.h 1.3 KB

1234567891011121314151617181920212223242526272829
  1. #pragma once
  2. namespace il2cpp
  3. {
  4. namespace utils
  5. {
  6. struct LIBIL2CPP_CODEGEN_API Memory
  7. {
  8. static void SetMemoryCallbacks(Il2CppMemoryCallbacks* callbacks);
  9. static void* Malloc(size_t size);
  10. static void* AlignedMalloc(size_t size, size_t alignment);
  11. static void Free(void* memory);
  12. static void AlignedFree(void* memory);
  13. static void* Calloc(size_t count, size_t size);
  14. static void* Realloc(void* memory, size_t newSize);
  15. static void* AlignedRealloc(void* memory, size_t newSize, size_t alignment);
  16. };
  17. } /* namespace utils */
  18. } /* namespace il2cpp */
  19. #define IL2CPP_MALLOC(size) il2cpp::utils::Memory::Malloc(size)
  20. #define IL2CPP_MALLOC_ALIGNED(size, alignment) il2cpp::utils::Memory::AlignedMalloc(size, alignment)
  21. #define IL2CPP_MALLOC_ZERO(size) il2cpp::utils::Memory::Calloc(1,size)
  22. #define IL2CPP_FREE(memory) il2cpp::utils::Memory::Free(memory)
  23. #define IL2CPP_FREE_ALIGNED(memory) il2cpp::utils::Memory::AlignedFree(memory)
  24. #define IL2CPP_CALLOC(count, size) il2cpp::utils::Memory::Calloc(count,size)
  25. #define IL2CPP_REALLOC(memory, newSize) il2cpp::utils::Memory::Realloc(memory,newSize)
  26. #define IL2CPP_REALLOC_ALIGNED(memory, newSize, alignment) il2cpp::utils::Memory::AlignedRealloc(memory, newSize, alignment)