Hi! I try to use boost::pool_alloc with STLport-4.5-0119 snapshot. STLPort call pool_alloc::allocate(const size_type n) with n = 0. STLPort naitive allocator returns in such case NULL, but pool_alloc tries return memory. Method simple_segregated_storage<SizeType>::try_malloc_n( void * & start, size_type n, const size_type partition_size) has problem too if parameter n is 0. Problem is in while condition: while (--n != 0)... This simple program demonstrates a problem: #include <boost/pool/poolfwd.hpp> #include <boost/pool/pool_alloc.hpp> typedef boost::pool_allocator<int> alloc_t; int main(int argc, char* argv[]) { alloc_t alloc; alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); alloc.allocate(0); return 0; } How can I solve this problem? Thanks -Ilya
participants (1)
-
Ilya Chvetsov(work)