Subject: [Boost-bugs] [Boost C++ Libraries] #2696: max_size for boost pool
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-01-29 16:06:27
#2696: max_size for boost pool
--------------------------+-------------------------------------------------
Reporter: nikiml | Owner:
Type: Bugs | Status: new
Milestone: Boost 1.38.0 | Component: None
Version: Boost 1.37.0 | Severity: Problem
Keywords: |
--------------------------+-------------------------------------------------
The malloc_needs_resize, ordered_malloc_needs_resize and ordered_malloc
members of the pool class double the size of the chunk requested from the
operating system every time they cannot satisfy request.
Consider a scenario in which the client allocates about 900Mb before
releases the initial size of the pool is 128Mb.
on the 1st request from the client the pool will request 128 MB from the
OS
when the client uses 128M -> 256MB will be requested from the os
when the client uses 384M -> 512MB will be requested from the os
when the client uses 896M -> 1GB will be requested from the os (which is
already likely to fail)
when the client reaches 900M the pool will have close to 2Gb memory
allocated from the OS.
But the client will be perfectly happy if the pool just allocates 128M
from the OS when it is exhausted, provided 128Mb is large enough to
satisfy any single request from the client.
The supplied patch allow for a cap on the chunks the pool is allocating
from the OS.
This is done by adding a default last parameter max_size which when left
at the default of 0 leads to the uncapped behavior.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/2696> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC