Re: [boost] [block_ptr] Request for a review manager
Phil Bouchard wrote:
I added the new repository with the right folder structure: https://github.com/philippeb8/block_ptr
You should update this to work with the latest Boost, because currently block_base is abstract as it doesn't implement
virtual void * get_untyped_deleter() = 0;
It also doesn't work with -DBOOST_DISABLE_THREADS, which makes it inconvenient to test as it requires Boost.Thread.
Phil Bouchard wrote:
I added the new repository with the right folder structure: https://github.com/philippeb8/block_ptr
Here's one vector example that shows what I had in mind: #include <boost/block_ptr.hpp> #include <vector> #include <iostream> struct X { static int instances; std::vector< boost::block_ptr<X> > v_; X() { ++instances; std::cout << "X(" << this << ")::X()\n"; v_.reserve( 4 ); } ~X() { std::cout << "X(" << this << ")::~X()\n"; --instances; } }; int X::instances = 0; int main() { boost::block_ptr<X> p = boost::make_block<X>(); p->v_.push_back( p ); std::cout << "--\n"; p.reset(); std::cout << "--\n"; } It doesn't seem to release the cycle. Other, more convoluted, examples can also be constructed, where the inner pointer is inside a std::function member of X storing a lambda/std::bind capturing p.
On 02/09/2016 12:08 PM, Peter Dimov wrote:
Phil Bouchard wrote:
I added the new repository with the right folder structure: https://github.com/philippeb8/block_ptr
Here's one vector example that shows what I had in mind:
#include <boost/block_ptr.hpp> #include <vector> #include <iostream>
struct X { static int instances;
std::vector< boost::block_ptr<X> > v_;
X() { ++instances; std::cout << "X(" << this << ")::X()\n";
v_.reserve( 4 ); }
~X() { std::cout << "X(" << this << ")::~X()\n"; --instances; } };
int X::instances = 0;
int main() { boost::block_ptr<X> p = boost::make_block<X>();
p->v_.push_back( p );
std::cout << "--\n";
p.reset();
std::cout << "--\n"; }
It doesn't seem to release the cycle.
Like I was saying in a PM, containers should use block_allocator<>: https://github.com/philippeb8/block_ptr/blob/master/example/block_ptr_test3.... It works well but Peter discovered a deadlock in reset() so perhaps it's a simple fix.
On 02/09/2016 11:51 AM, Peter Dimov wrote:
Phil Bouchard wrote:
I added the new repository with the right folder structure: https://github.com/philippeb8/block_ptr
You should update this to work with the latest Boost, because currently block_base is abstract as it doesn't implement
virtual void * get_untyped_deleter() = 0;
It also doesn't work with -DBOOST_DISABLE_THREADS, which makes it inconvenient to test as it requires Boost.Thread.
I just fixed the code to support the latest standards and -DBOOST_DISABLE_THREADS.
On 2016-02-09 9:52 PM, Phil Bouchard wrote:
On 02/09/2016 11:51 AM, Peter Dimov wrote:
Phil Bouchard wrote:
I added the new repository with the right folder structure: https://github.com/philippeb8/block_ptr
You should update this to work with the latest Boost, because currently block_base is abstract as it doesn't implement
virtual void * get_untyped_deleter() = 0;
It also doesn't work with -DBOOST_DISABLE_THREADS, which makes it inconvenient to test as it requires Boost.Thread.
I just fixed the code to support the latest standards and -DBOOST_DISABLE_THREADS.
Unfortunately it's going to take some time supporting MSVC 2015 because of their use of proxies with STL containers making the support of user defined allocators more complicated...
On 2016-02-12 11:39 PM, Phil Bouchard wrote:
On 2016-02-09 9:52 PM, Phil Bouchard wrote:
On 02/09/2016 11:51 AM, Peter Dimov wrote:
Phil Bouchard wrote:
I added the new repository with the right folder structure: https://github.com/philippeb8/block_ptr
You should update this to work with the latest Boost, because currently block_base is abstract as it doesn't implement
virtual void * get_untyped_deleter() = 0;
It also doesn't work with -DBOOST_DISABLE_THREADS, which makes it inconvenient to test as it requires Boost.Thread.
I just fixed the code to support the latest standards and -DBOOST_DISABLE_THREADS.
Unfortunately it's going to take some time supporting MSVC 2015 because of their use of proxies with STL containers making the support of user defined allocators more complicated...
Settings the _ITERATOR_DEBUG_LEVEL=0 preprocessor flag helps disabling the proxy usages...
On 2016-02-13 1:12 AM, Phil Bouchard wrote:
On 2016-02-12 11:39 PM, Phil Bouchard wrote:
On 2016-02-09 9:52 PM, Phil Bouchard wrote:
On 02/09/2016 11:51 AM, Peter Dimov wrote:
Phil Bouchard wrote:
I added the new repository with the right folder structure: https://github.com/philippeb8/block_ptr
You should update this to work with the latest Boost, because currently block_base is abstract as it doesn't implement
virtual void * get_untyped_deleter() = 0;
It also doesn't work with -DBOOST_DISABLE_THREADS, which makes it inconvenient to test as it requires Boost.Thread.
I just fixed the code to support the latest standards and -DBOOST_DISABLE_THREADS.
Unfortunately it's going to take some time supporting MSVC 2015 because of their use of proxies with STL containers making the support of user defined allocators more complicated...
Settings the _ITERATOR_DEBUG_LEVEL=0 preprocessor flag helps disabling the proxy usages...
It looks like I was able to fix a bug which makes it run correctly under MSVC 2015 Express. Although I do have a crash in the boost::pool: Project2.exe!boost::simple_segregated_storage<unsigned int>::try_malloc_n(void * & start, unsigned int n, unsigned int partition_size) Line 333 C++ Project2.exe!boost::simple_segregated_storage<unsigned int>::malloc_n(unsigned int n, unsigned int partition_size) Line 363 C++ Project2.exe!boost::pool<boost::default_user_allocator_new_delete>::ordered_malloc(unsigned int n) Line 801 C++ Project2.exe!boost::singleton_pool<boost::detail::bp::pool,1,boost::default_user_allocator_new_delete,boost::details::pool::null_mutex,32,0>::ordered_malloc(const unsigned int n) Line 149 C++ Project2.exe!boost::detail::bp::pool::allocate(unsigned int s) Line 148 C++ Project2.exe!boost::detail::bp::block<int>::operator new(unsigned int s) Line 283 C++ Project2.exe!boost::detail::bp::make_block<int,int>(const int & t0) Line 520 C++
Project2.exe!main() Line 119 C++
When I try this example: https://github.com/philippeb8/block_ptr/blob/master/example/block_ptr_test2.... Thanks, -Phil
On 02/09/2016 09:52 PM, Phil Bouchard wrote:
On 02/09/2016 11:51 AM, Peter Dimov wrote:
Phil Bouchard wrote:
I added the new repository with the right folder structure: https://github.com/philippeb8/block_ptr
You should update this to work with the latest Boost, because currently block_base is abstract as it doesn't implement
virtual void * get_untyped_deleter() = 0;
It also doesn't work with -DBOOST_DISABLE_THREADS, which makes it inconvenient to test as it requires Boost.Thread.
I just fixed the code to support the latest standards and -DBOOST_DISABLE_THREADS.
I cleaned up the Makefiles and now it works right of the box on Linux systems...
participants (3)
-
Peter Dimov
-
Phil Bouchard
-
Phil Bouchard