Add Polymorphic Memory Resource utilities and rework the separately compiled library:

- Dlmalloc's based C function are boost_cont_xxx no longer exported, but wrapped into C++ linkage dlmalloc_xxx functions to effectively reuse Boost's dynamic library and autolink machinery instead of rewriting machinery to compile the C source file.
- Refactored scoped_allocator_adaptor's construct logic as it was shared with polymorphic allocator's one. Moved common logic to detail/dispatch_uses_allocator.hpp. Refactored also scoped_allocator_adaptor test utilities to be reused with polymorphic_allocator tests.
This commit is contained in:
Ion Gaztañaga
2015-09-07 19:16:46 +02:00
parent 77100c0bfc
commit 33d2f0f7af
110 changed files with 10143 additions and 1160 deletions
+7 -7
View File
@@ -129,7 +129,7 @@ void list_test_template(std::size_t num_iterations, std::size_t num_elements, bo
{
typedef typename Allocator::template rebind<MyInt>::other IntAllocator;
nanosecond_type tinsert, terase;
boost_cont_malloc_stats_t insert_stats, erase_stats;
bc::dlmalloc_malloc_stats_t insert_stats, erase_stats;
std::size_t insert_inuse, erase_inuse;
const size_t sizeof_node = 2*sizeof(void*)+sizeof(int);
@@ -145,8 +145,8 @@ void list_test_template(std::size_t num_iterations, std::size_t num_elements, bo
timer.stop();
tinsert = timer.elapsed().wall;
insert_inuse = boost_cont_in_use_memory();
insert_stats = boost_cont_malloc_stats();
insert_inuse = bc::dlmalloc_in_use_memory();
insert_stats = bc::dlmalloc_malloc_stats();
/*
iterator_t it(l.begin());
iterator_t last(--l.end());
@@ -175,8 +175,8 @@ void list_test_template(std::size_t num_iterations, std::size_t num_elements, bo
}
timer.stop();
terase = timer.elapsed().wall;
erase_inuse = boost_cont_in_use_memory();
erase_stats = boost_cont_malloc_stats();
erase_inuse = bc::dlmalloc_in_use_memory();
erase_stats = bc::dlmalloc_malloc_stats();
}
@@ -214,7 +214,7 @@ void list_test_template(std::size_t num_iterations, std::size_t num_elements, bo
<< " / "
<< (float)insert_inuse/(1024*1024) << "(" << (float(insert_inuse)/(num_iterations*num_elements*sizeof_node)*100.0)-100.0 << "%)"
<< std::endl
<< " system MB/inuse bytes after: " << (float)erase_stats.system_bytes/(1024*1024) << '\t' << boost_cont_in_use_memory()
<< " system MB/inuse bytes after: " << (float)erase_stats.system_bytes/(1024*1024) << '\t' << bc::dlmalloc_in_use_memory()
<< std::endl << std::endl;
}
@@ -243,7 +243,7 @@ void list_test_template(std::size_t num_iterations, std::size_t num_elements, bo
boost::container::container_detail::singleton_default
<shared_adaptive_pool_plus_align_only_t>::instance().deallocate_free_blocks();
//Release dlmalloc memory
boost_cont_trim(0);
bc::dlmalloc_trim(0);
}
void print_header()