Modify

Ticket #2696 (closed Bugs: fixed)

Opened 5 years ago

Last modified 3 years ago

max_size for boost pool

Reported by: nikiml Owned by: cnewbold
Milestone: Boost 1.38.0 Component: pool
Version: Boost 1.37.0 Severity: Problem
Keywords: Cc: boostpool@…

Description

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.

Attachments

pool.patch Download (9.3 KB) - added by nikiml 5 years ago.
boost-pool-maxsize-patch-issue2696.diff Download (11.9 KB) - added by mikhailberis 3 years ago.
Update to original patch to apply to r66834 -- tested locally without failures, GCC 4.4 Linux.

Change History

Changed 5 years ago by nikiml

comment:1 Changed 5 years ago by steven_watanabe

  • Owner set to cnewbold
  • Component changed from None to pool

Changed 3 years ago by mikhailberis

Update to original patch to apply to r66834 -- tested locally without failures, GCC 4.4 Linux.

comment:2 Changed 3 years ago by johnmaddock

  • Cc john@… added

Note to all:

Marshall Clow plans to apply this to Trunk (and then release) to make sure it gets into 1.46. We still need a test case for this though...

comment:3 Changed 3 years ago by johnmaddock

  • Cc boostpool@… added; john@… removed

comment:4 Changed 3 years ago by marshall

(In [67752]) Applied patch; refs #2696

comment:5 Changed 3 years ago by marshall

  • Status changed from new to closed
  • Resolution set to fixed

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

comment:6 Changed 3 years ago by johnmaddock

  • Status changed from closed to reopened
  • Resolution fixed deleted

We should update the docs and tests for this issue - reopened for now so we don't forget :)

comment:7 Changed 3 years ago by johnmaddock

(In [69236]) Some further more advanced fixes for issue #2696: Applies existing fix to array allocation, Adds a test case, Adds a fallback mechanism, so that if allocation fails we shrink the next chunk size. Refs #2696.

comment:8 Changed 3 years ago by johnmaddock

  • Status changed from reopened to closed
  • Resolution set to fixed

(In [73495]) Merge updated Pool lib from trunk. Fixes #1252. Fixes #2696. Fixes #4960. Fixes #5526. Fixes #5568. Fixes #5700.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


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

 
Note: See TracTickets for help on using tickets.