Pool size is doubled on each ordered_malloc call
- Dominant language
- HTML
- Stars
- 8.6k
- Forks
- 1.9k
- Avg merge
- 39m
- Merged PRs (30d)
- 2
Description
Encountered a similar issue with: https://github.com/boostorg/pool/issues/54 when I upgraded from boost 1.70 to 1.88. Repeated use of purge_memory() results in pool size extension with two times the previous size when ordered_malloc is called.
Sample Code:
```
int main()
{
boost::pool<> bufferMemPool(sizeof(WCHAR), 32768);
for (int i = 0; i < 10; i++)
{
LPWSTR buffer = static_cast(bufferMemPool.ordered_malloc());
if (buffer) {
std::wcout << "get_next_size(): " << bufferMemPool.get_next_size() << std::endl;
bufferMemPool.ordered_free(buffer);
}
else {
std::wcerr << L"Memory allocation failed." << std::endl;
}
bufferMemPool.purge_memory();
}
return 0;
}
```
Output:
```
get_next_size(): 65536
get_next_size(): 131072
get_next_size(): 262144
get_next_size(): 524288
get_next_size(): 1048576
get_next_size(): 2097152
get_next_size(): 4194304
get_next_size(): 8388608
get_next_size(): 16777216
get_next_size(): 33554432
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.