BsMemAllocProfiler.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. /** @cond INTERNAL */
  7. /** @addtogroup Memory
  8. * @{
  9. */
  10. /**
  11. * Specialized allocator for profiler so we can avoid tracking internal profiler memory allocations which would skew
  12. * profiler results.
  13. */
  14. class ProfilerAlloc
  15. {};
  16. /** Memory allocator providing a generic implementation. Specialize for specific categories as needed. */
  17. template<>
  18. class MemoryAllocator<ProfilerAlloc> : public MemoryAllocatorBase
  19. {
  20. public:
  21. /** Allocates the given number of bytes. */
  22. static void* allocate(size_t bytes)
  23. {
  24. return malloc(bytes);
  25. }
  26. /** Frees memory previously allocated with allocate(). */
  27. static void free(void* ptr)
  28. {
  29. ::free(ptr);
  30. }
  31. };
  32. /** @} */
  33. /** @endcond */
  34. }