Ticket #386 (closed Bugs: fixed)

Opened 12 years ago

Last modified 6 years ago

boost::pool_allocator breaks with vector of vectors

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

Description (last modified by marshall) (diff)

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

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       
typedef std::vector<EventVector>        IndexVector;

int main() {
               IndexVector iv;
               std::cout << "it works\n";
       return 0;


pool.patch Download (1.7 KB) - added by steven_watanabe 8 years ago.
patch and test case.

Change History

comment:1 Changed 11 years ago by nobody

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 Changed 11 years ago by nobody

Logged In: NO 

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

comment:3 Changed 11 years ago by verntx

Logged In: YES 

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 Changed 10 years ago by anonymous

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 Changed 9 years ago by marshall

  • Component changed from None to pool
  • Description modified (diff)
  • Severity set to Showstopper

comment:6 Changed 9 years ago by marshall

  • Severity changed from Showstopper to Problem

comment:7 Changed 8 years ago by steven_watanabe

This is probably the same as #2869

Changed 8 years ago by steven_watanabe

patch and test case.

comment:8 Changed 7 years ago by steven_watanabe

  • Status changed from assigned to closed
  • Resolution changed from None to fixed

(In [56998]) Allow zero-sized blocks to be allocated by malloc_n. Fixes #386

comment:9 Changed 6 years ago by marshall

(In [67958]) Merging fixes to release; Fixes #2696; Refs #4346; Refs #2941; Refs #386


Add a comment

Modify Ticket

Change Properties
<Author field>
as closed
The resolution will be deleted. Next status will be 'reopened'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.