/usr/include/boost/smart_ptr/detail
NameSizeModeActions
atomic_count.hpp32320644editdlrm
atomic_count_gcc.hpp16230644editdlrm
atomic_count_gcc_atomic.hpp12770644editdlrm
atomic_count_gcc_x86.hpp17390644editdlrm
atomic_count_nt.hpp12000644editdlrm
atomic_count_pt.hpp20600644editdlrm
atomic_count_spin.hpp13060644editdlrm
atomic_count_std_atomic.hpp13490644editdlrm
atomic_count_sync.hpp14350644editdlrm
atomic_count_win32.hpp13540644editdlrm
lightweight_mutex.hpp12570644editdlrm
lightweight_thread.hpp34420644editdlrm
local_counted_base.hpp32170644editdlrm
local_sp_deleter.hpp17310644editdlrm
lwm_pthreads.hpp17530644editdlrm
lwm_std_mutex.hpp10770644editdlrm
lwm_win32_cs.hpp27960644editdlrm
operator_bool.hpp17310644editdlrm
quick_allocator.hpp51370644editdlrm
shared_count.hpp153670644editdlrm
spinlock.hpp18630644editdlrm
spinlock_gcc_arm.hpp27010644editdlrm
spinlock_gcc_atomic.hpp15190644editdlrm
spinlock_nt.hpp16260644editdlrm
spinlock_pool.hpp29540644editdlrm
spinlock_pt.hpp14740644editdlrm
spinlock_std_atomic.hpp17230644editdlrm
spinlock_sync.hpp16440644editdlrm
spinlock_w32.hpp21040644editdlrm
sp_convertible.hpp21570644editdlrm
sp_counted_base.hpp34800644editdlrm
sp_counted_base_acc_ia64.hpp34980644editdlrm
sp_counted_base_aix.hpp32700644editdlrm
sp_counted_base_cw_ppc.hpp34260644editdlrm
sp_counted_base_gcc_atomic.hpp33310644editdlrm
sp_counted_base_gcc_ia64.hpp40100644editdlrm
sp_counted_base_gcc_mips.hpp40970644editdlrm
sp_counted_base_gcc_ppc.hpp38770644editdlrm
sp_counted_base_gcc_sparc.hpp38500644editdlrm
sp_counted_base_gcc_x86.hpp39360644editdlrm
sp_counted_base_nt.hpp27330644editdlrm
sp_counted_base_pt.hpp37260644editdlrm
sp_counted_base_snc_ps3.hpp37760644editdlrm
sp_counted_base_spin.hpp30730644editdlrm
sp_counted_base_std_atomic.hpp35570644editdlrm
sp_counted_base_sync.hpp33260644editdlrm
sp_counted_base_vacpp_ppc.hpp36970644editdlrm
sp_counted_base_w32.hpp32640644editdlrm
sp_counted_impl.hpp68080644editdlrm
sp_disable_deprecated.hpp9830644editdlrm
sp_forward.hpp11800644editdlrm
sp_has_gcc_intrinsics.hpp7860644editdlrm
sp_has_sync_intrinsics.hpp18720644editdlrm
sp_interlocked.hpp65670644editdlrm
sp_noexcept.hpp11850644editdlrm
sp_nullptr_t.hpp9760644editdlrm
sp_obsolete.hpp9140644editdlrm
sp_thread_pause.hpp11010644editdlrm
sp_thread_sleep.hpp20160644editdlrm
sp_thread_yield.hpp18830644editdlrm
sp_typeinfo_.hpp11760644editdlrm
sp_win32_sleep.hpp11680644editdlrm
yield_k.hpp10910644editdlrm
Edit: /usr/include/boost/smart_ptr/detail/quick_allocator.hpp (5137B)
#ifndef BOOST_SMART_PTR_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED #define BOOST_SMART_PTR_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED // MS compatible compilers support #pragma once #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif // // detail/quick_allocator.hpp // // Copyright (c) 2003 David Abrahams // Copyright (c) 2003 Peter Dimov // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // #include #include #include #include #include // ::operator new, ::operator delete #include // std::size_t namespace boost { namespace detail { template union freeblock { typedef typename boost::type_with_alignment::type aligner_type; aligner_type aligner; char bytes[size]; freeblock * next; }; template struct allocator_impl { typedef freeblock block; // It may seem odd to use such small pages. // // However, on a typical Windows implementation that uses // the OS allocator, "normal size" pages interact with the // "ordinary" operator new, slowing it down dramatically. // // 512 byte pages are handled by the small object allocator, // and don't interfere with ::new. // // The other alternative is to use much bigger pages (1M.) // // It is surprisingly easy to hit pathological behavior by // varying the page size. g++ 2.96 on Red Hat Linux 7.2, // for example, passionately dislikes 496. 512 seems OK. #if defined(BOOST_QA_PAGE_SIZE) enum { items_per_page = BOOST_QA_PAGE_SIZE / size }; #else enum { items_per_page = 512 / size }; // 1048560 / size #endif #ifdef BOOST_HAS_THREADS static lightweight_mutex & mutex() { static freeblock< sizeof( lightweight_mutex ), boost::alignment_of< lightweight_mutex >::value > fbm; static lightweight_mutex * pm = new( &fbm ) lightweight_mutex; return *pm; } static lightweight_mutex * mutex_init; #endif static block * free; static block * page; static unsigned last; static inline void * alloc() { #ifdef BOOST_HAS_THREADS lightweight_mutex::scoped_lock lock( mutex() ); #endif if(block * x = free) { free = x->next; return x; } else { if(last == items_per_page) { // "Listen to me carefully: there is no memory leak" // -- Scott Meyers, Eff C++ 2nd Ed Item 10 page = ::new block[items_per_page]; last = 0; } return &page[last++]; } } static inline void * alloc(std::size_t n) { if(n != size) // class-specific new called for a derived object { return ::operator new(n); } else { #ifdef BOOST_HAS_THREADS lightweight_mutex::scoped_lock lock( mutex() ); #endif if(block * x = free) { free = x->next; return x; } else { if(last == items_per_page) { page = ::new block[items_per_page]; last = 0; } return &page[last++]; } } } static inline void dealloc(void * pv) { if(pv != 0) // 18.4.1.1/13 { #ifdef BOOST_HAS_THREADS lightweight_mutex::scoped_lock lock( mutex() ); #endif block * pb = static_cast(pv); pb->next = free; free = pb; } } static inline void dealloc(void * pv, std::size_t n) { if(n != size) // class-specific delete called for a derived object { ::operator delete(pv); } else if(pv != 0) // 18.4.1.1/13 { #ifdef BOOST_HAS_THREADS lightweight_mutex::scoped_lock lock( mutex() ); #endif block * pb = static_cast(pv); pb->next = free; free = pb; } } }; #ifdef BOOST_HAS_THREADS template lightweight_mutex * allocator_impl::mutex_init = &allocator_impl::mutex(); #endif template freeblock * allocator_impl::free = 0; template freeblock * allocator_impl::page = 0; template unsigned allocator_impl::last = allocator_impl::items_per_page; template struct quick_allocator: public allocator_impl< sizeof(T), boost::alignment_of::value > { }; } // namespace detail } // namespace boost #endif // #ifndef BOOST_SMART_PTR_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED