BsMemAllocProfiler.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. namespace BansheeEngine
  5. {
  6. /** @addtogroup Internal-Utility
  7. * @{
  8. */
  9. /** @addtogroup Memory-Internal
  10. * @{
  11. */
  12. /**
  13. * Specialized allocator for profiler so we can avoid tracking internal profiler memory allocations which would skew
  14. * profiler results.
  15. */
  16. class ProfilerAlloc
  17. {};
  18. /** Memory allocator providing a generic implementation. Specialize for specific categories as needed. */
  19. template<>
  20. class MemoryAllocator<ProfilerAlloc> : public MemoryAllocatorBase
  21. {
  22. public:
  23. /** Allocates the given number of bytes. */
  24. static void* allocate(size_t bytes)
  25. {
  26. return malloc(bytes);
  27. }
  28. /** Frees memory previously allocated with allocate(). */
  29. static void free(void* ptr)
  30. {
  31. ::free(ptr);
  32. }
  33. };
  34. /** @} */
  35. /** @} */
  36. }