Ticket #386: pool.patch
File pool.patch, 1.7 KB (added by , 13 years ago) |
---|
-
boost/pool/simple_segregated_storage.hpp
147 147 void free_n(void * const chunks, const size_type n, 148 148 const size_type partition_size) 149 149 { 150 add_block(chunks, n * partition_size, partition_size); 150 if(n != 0) 151 add_block(chunks, n * partition_size, partition_size); 151 152 } 152 153 153 154 // pre: chunks was previously allocated from *this with the same … … 156 157 void ordered_free_n(void * const chunks, const size_type n, 157 158 const size_type partition_size) 158 159 { 159 add_ordered_block(chunks, n * partition_size, partition_size); 160 if(n != 0) 161 add_ordered_block(chunks, n * partition_size, partition_size); 160 162 } 161 163 }; 162 164 … … 247 249 void * simple_segregated_storage<SizeType>::malloc_n(const size_type n, 248 250 const size_type partition_size) 249 251 { 252 if(n == 0) 253 return 0; 250 254 void * start = &first; 251 255 void * iter; 252 256 do -
libs/pool/test/test_pool_alloc.cpp
215 215 // clean up memory leak 216 216 tmp->~tester(); 217 217 boost::pool_allocator<tester>::deallocate(tmp, 1); 218 219 // test allocating zero elements 220 { 221 boost::pool_allocator<tester> alloc; 222 tester* ip = alloc.allocate(0); 223 alloc.deallocate(ip, 0); 224 } 218 225 } 219 226 220 227 // This is a wrapper around a UserAllocator. It just registers alloc/dealloc