2 // impl/handler_alloc_hook.ipp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 // Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
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)
11 #ifndef BOOST_ASIO_IMPL_HANDLER_ALLOC_HOOK_IPP
12 #define BOOST_ASIO_IMPL_HANDLER_ALLOC_HOOK_IPP
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 #include <boost/asio/detail/config.hpp>
19 #include <boost/asio/detail/memory.hpp>
20 #include <boost/asio/detail/thread_context.hpp>
21 #include <boost/asio/detail/thread_info_base.hpp>
22 #include <boost/asio/handler_alloc_hook.hpp>
24 #include <boost/asio/detail/push_options.hpp>
29 asio_handler_allocate_is_deprecated
30 asio_handler_allocate(std::size_t size, ...)
32 #if defined(BOOST_ASIO_NO_DEPRECATED)
34 return asio_handler_allocate_is_no_longer_used();
35 #elif !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
36 return detail::thread_info_base::allocate(
37 detail::thread_context::top_of_thread_call_stack(), size);
38 #else // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
39 return aligned_new(BOOST_ASIO_DEFAULT_ALIGN, size);
40 #endif // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
43 asio_handler_deallocate_is_deprecated
44 asio_handler_deallocate(void* pointer, std::size_t size, ...)
46 #if defined(BOOST_ASIO_NO_DEPRECATED)
49 return asio_handler_deallocate_is_no_longer_used();
50 #elif !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
51 detail::thread_info_base::deallocate(
52 detail::thread_context::top_of_thread_call_stack(), pointer, size);
53 #else // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
55 aligned_delete(pointer)
56 #endif // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
62 #include <boost/asio/detail/pop_options.hpp>
64 #endif // BOOST_ASIO_IMPL_HANDLER_ALLOC_HOOK_IPP