Modify

Opened 12 years ago

Closed 8 years ago

Last modified 6 years ago

#386 closed Bugs (fixed)

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)

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

Attachments (1)

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

Download all attachments as: .zip

Change History (10)

comment:1 Changed 12 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 
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 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 10 years ago by marshall

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

comment:6 Changed 10 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 8 years ago by steven_watanabe

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

(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 Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain shammah.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.