[REGRESSION] Pool size is extended on each allocation
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start by tracing malloc_need_resize() and set_next_size(), focusing on how start_size and next_size change after purge_memory(). Reproduce the provided C++ example and compare get_next_size() across repeated allocations. Done means repeated purge_memory() calls no longer double the pool size after each use, matching the expected stable output.
Written by the indexing model from the issue text.
Description
Reported in Boost mailing list: https://lists.boost.org/Archives/boost/2023/06/254750.php
951ca5725 changed malloc_need_resize() to use set_next_size(), which
sets start_size in addition to setting next_size. this causes repeated use
of purge_memory() to allocate 2x size after every use. an illustration:
#include <boost/pool/pool.hpp>
int main()
{
boost::pool pool(8);
for(int i = 0; i < 10; i++) {
printf("%d %ld\n", i, pool.get_next_size());
pool.purge_memory();
void *ptr = pool.malloc();
(void)ptr;
}
}
before the commit the output is:
0 32
1 64
2 64
3 64
4 64
5 64
6 64
7 64
8 64
9 64
after the commit, the output is:
0 32
1 64
2 128
3 256
4 512
5 1024
6 2048
7 4096
8 8192
9 16384
- Dominant language
- C++
- Stars
- 58
- Forks
- 52
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/pool
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·