Re: [Boost-bugs] [Boost C++ Libraries] #386: boost::pool_allocator breaks with vector of vectors

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #386: boost::pool_allocator breaks with vector of vectors
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2007-11-21 00:09:39


#386: boost::pool_allocator breaks with vector of vectors
----------------------+-----------------------------------------------------
  Reporter: glr9940 | Owner: shammah
      Type: Bugs | Status: assigned
 Milestone: | Component: pool
   Version: None | Severity: Showstopper
Resolution: None | Keywords:
----------------------+-----------------------------------------------------
Changes (by marshall):

  * component: None => pool
  * severity: => Showstopper

Old description:

> {{{
> The resulting executable built with the following code
> under GCC 3.3.5 produces a segmentation fault when
> run:
>
> Note that switching the definition of EventVector to use
> a vector with a standard allocator will fix the problem.
>
> Also note that the definition of IndexVector doesn't seem
> to matter.
>
> #include <boost/pool/pool_alloc.hpp>
> #include <vector>
> #include <iostream>
>
> template <typename DataType>
> struct PooledVector {
> typedef std::vector<DataType,
> boost::pool_allocator<DataType> > Type;
> };
>
> typedef PooledVector<int>::Type EventVector;
> //typedef std::vector<int> EventVector;
>
> //typedef PooledVector<EventVector>::Type
> IndexVector;
> typedef std::vector<EventVector> IndexVector;
>
> int main() {
> IndexVector iv;
> iv.push_back(EventVector());
> iv.back().push_back(3);
> std::cout << "it works\n";
> return 0;
> }
>
> }}}

New description:

 {{{
 The resulting executable built with the following code
 under GCC 3.3.5 produces a segmentation fault when
 run:

 Note that switching the definition of EventVector to use
 a vector with a standard allocator will fix the problem.

 Also note that the definition of IndexVector doesn't seem
 to matter.

 #include <boost/pool/pool_alloc.hpp>
 #include <vector>
 #include <iostream>

 template <typename DataType>
 struct PooledVector {
        typedef std::vector<DataType,
 boost::pool_allocator<DataType> > Type;
 };

 typedef PooledVector<int>::Type EventVector;
 //typedef std::vector<int> EventVector;

 //typedef PooledVector<EventVector>::Type
 IndexVector;
 typedef std::vector<EventVector> IndexVector;

 int main() {
                IndexVector iv;
                iv.push_back(EventVector());
                iv.back().push_back(3);
                std::cout << "it works\n";
        return 0;
 }

 }}}

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/386#comment:5>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.


This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:57 UTC