Ticket #284: boost_pool.patch

File boost_pool.patch, 1.4 KB (added by Marcus Lindblom <macke@…>, 15 years ago)

Patch that adresses this bug

  • pool.hpp

    old new  
    153153    const simple_segregated_storage<size_type> & store() const { return *this; }
    154154    const size_type requested_size;
    155155    size_type next_size;
     156    size_type start_size;
    156157
    157158    // finds which POD in the list 'chunk' was allocated from
    158159    details::PODptr<size_type> find_POD(void * const chunk) const;
     
    192193    // pre: npartition_size != 0 && nnext_size != 0
    193194    explicit pool(const size_type nrequested_size,
    194195        const size_type nnext_size = 32)
    195     :list(0, 0), requested_size(nrequested_size), next_size(nnext_size)
     196    :list(0, 0), requested_size(nrequested_size), next_size(nnext_size), start_size(nnext_size)
    196197    { }
    197198
    198199    ~pool() { purge_memory(); }
     
    208209
    209210    // These functions are extensions!
    210211    size_type get_next_size() const { return next_size; }
    211     void set_next_size(const size_type nnext_size) { next_size = nnext_size; }
     212    void set_next_size(const size_type nnext_size) { next_size = nnext_size; start_size = nnext_size; }
    212213
    213214    // Both malloc and ordered_malloc do a quick inlined check first for any
    214215    //  free chunks.  Only if we need to get another memory block do we call
     
    419420
    420421  list.invalidate();
    421422  this->first = 0;
     423
     424  next_size = start_size;
    422425
    423426  return true;
    424427}