MemoryPoolAddressSanitizer.cpp 890 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include "il2cpp-config.h"
  2. #if IL2CPP_SANITIZE_ADDRESS
  3. #include "utils/MemoryPoolAddressSanitizer.h"
  4. namespace il2cpp
  5. {
  6. namespace utils
  7. {
  8. MemoryPoolAddressSanitizer::MemoryPoolAddressSanitizer()
  9. {
  10. }
  11. MemoryPoolAddressSanitizer::MemoryPoolAddressSanitizer(size_t initialSize)
  12. {
  13. }
  14. MemoryPoolAddressSanitizer::~MemoryPoolAddressSanitizer()
  15. {
  16. for (auto allocation : m_Allocations)
  17. free(allocation);
  18. m_Allocations.clear();
  19. }
  20. void* MemoryPoolAddressSanitizer::Malloc(size_t size)
  21. {
  22. void* allocation = malloc(size);
  23. m_Allocations.push_back(allocation);
  24. return allocation;
  25. }
  26. void* MemoryPoolAddressSanitizer::Calloc(size_t count, size_t size)
  27. {
  28. void* allocation = calloc(count, size);
  29. m_Allocations.push_back(allocation);
  30. return allocation;
  31. }
  32. }
  33. }
  34. #endif