Modify

Opened 13 years ago

Closed 8 years ago

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

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 Clow

Component: Nonepool
Description: modified (diff)
Severity: Showstopper

comment:6 Changed 10 years ago by Marshall Clow

Severity: ShowstopperProblem

comment:7 Changed 9 years ago by Steven Watanabe

This is probably the same as #2869

Changed 8 years ago by Steven Watanabe

Attachment: pool.patch added

patch and test case.

comment:8 Changed 8 years ago by Steven Watanabe

Resolution: Nonefixed
Status: assignedclosed

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

comment:9 Changed 7 years ago by Marshall Clow

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

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain shammah.
The resolution will be deleted.

Add Comment


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

 
Note: See TracTickets for help on using tickets.