Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

handler_alloc_hook.ipp 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // impl/handler_alloc_hook.ipp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  6. //
  7. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. #ifndef ASIO_IMPL_HANDLER_ALLOC_HOOK_IPP
  11. #define ASIO_IMPL_HANDLER_ALLOC_HOOK_IPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include "asio/detail/config.hpp"
  16. #include "asio/detail/thread_context.hpp"
  17. #include "asio/detail/thread_info_base.hpp"
  18. #include "asio/handler_alloc_hook.hpp"
  19. #include "asio/detail/push_options.hpp"
  20. namespace asio {
  21. void* asio_handler_allocate(std::size_t size, ...)
  22. {
  23. #if !defined(ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
  24. return detail::thread_info_base::allocate(
  25. detail::thread_context::thread_call_stack::top(), size);
  26. #else // !defined(ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
  27. return ::operator new(size);
  28. #endif // !defined(ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
  29. }
  30. void asio_handler_deallocate(void* pointer, std::size_t size, ...)
  31. {
  32. #if !defined(ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
  33. detail::thread_info_base::deallocate(
  34. detail::thread_context::thread_call_stack::top(), pointer, size);
  35. #else // !defined(ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
  36. (void)size;
  37. ::operator delete(pointer);
  38. #endif // !defined(ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
  39. }
  40. } // namespace asio
  41. #include "asio/detail/pop_options.hpp"
  42. #endif // ASIO_IMPL_HANDLER_ALLOC_HOOK_IPP