1 /* Copyright (C) 2011 Kwan Ting Chan 2 * 3 * Use, modification and distribution is subject to the 4 * Boost Software License, Version 1.0. (See accompanying 5 * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 6 */ 7 8 // Test of bug #4346 (https://svn.boost.org/trac/boost/ticket/4346) 9 10 #ifdef _MSC_VER 11 #define _CRTDBG_MAP_ALLOC 12 #include <stdlib.h> 13 #include <crtdbg.h> 14 #endif 15 16 #include <boost/pool/poolfwd.hpp> 17 #include <boost/pool/simple_segregated_storage.hpp> 18 #include <boost/pool/pool.hpp> 19 #include <boost/pool/pool_alloc.hpp> 20 #include <boost/pool/singleton_pool.hpp> 21 #include <boost/pool/object_pool.hpp> 22 23 #include <vector> 24 25 struct Foo {}; 26 main()27int main() 28 { 29 { 30 boost::pool<> p(sizeof(int)); 31 (p.malloc)(); 32 } 33 34 { 35 boost::object_pool<Foo> p; 36 (p.malloc)(); 37 } 38 39 { 40 (boost::singleton_pool<Foo, sizeof(int)>::malloc)(); 41 } 42 boost::singleton_pool<Foo, sizeof(int)>::purge_memory(); 43 44 { 45 std::vector<int, boost::pool_allocator<int> > v; 46 v.push_back(8); 47 } 48 boost::singleton_pool<boost::pool_allocator_tag, 49 sizeof(int)>::release_memory(); 50 } 51