-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Description
Encountered a similar issue with: boostorg/pool#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<LPWSTR>(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
Lyeuiechang and IRainman
Metadata
Metadata
Assignees
Labels
No labels