MemoryPool.h 487 B

1234567891011121314151617181920212223242526
  1. #pragma once
  2. #include <list>
  3. namespace il2cpp
  4. {
  5. namespace utils
  6. {
  7. class MemoryPool
  8. {
  9. public:
  10. MemoryPool();
  11. MemoryPool(size_t initialSize);
  12. ~MemoryPool();
  13. void* Malloc(size_t size);
  14. void* Calloc(size_t count, size_t size);
  15. private:
  16. struct Region;
  17. typedef std::list<Region*> RegionList;
  18. Region* AddRegion(size_t size);
  19. RegionList m_Regions;
  20. };
  21. } /* namespace utils */
  22. } /* namespace il2cpp */