Opened 18 years ago

Last modified 12 years ago

#386 closed Bugs (fixed)

boost::pool_allocator breaks with vector of vectors — at Version 5

Reported by: glr9940 Owned by: shammah
Milestone: Component: pool
Version: None Severity: Problem
Keywords: Cc:

Description (last modified by Marshall Clow)

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;
}

Change History (5)

comment:1 by nobody, 17 years ago

Logged In: NO 

I have the same problem making a
std::vector<std::vector<int, boost::pool_allocator<int> > >
on gcc 3.4.4




comment:2 by nobody, 16 years ago

Logged In: NO 

Having the same problem under MingW gcc 3.4.4 w/ STLPort 5.0
on Cygwin32.

comment:3 by verntx, 16 years ago

Logged In: YES 
user_id=1568291

ok, logged in now.
Having the same problem under MingW gcc 3.4.4 w/ STLPort 5.0
on Cygwin32.

Going to try enabling a lot of the STLport debugging stuff
to see if I can catch the allocators interfering w/ each other.

comment:4 by anonymous, 15 years ago

Under 1.33.1 with VS2005 I get a crash with a deque< object, boost::pool_allocator< object> >

Crash is in simple_segregated_storage<SizeType>::try_malloc_n

comment:5 by Marshall Clow, 15 years ago

Component: Nonepool
Description: modified (diff)
Severity: Showstopper
Note: See TracTickets for help on using tickets.