-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
std::vector<boost::dynamic_bitset<>>unable to free memory #51
Comments
I'm not seeing a memory leak here. What is
|
Hi, thanks for reply.
|
Hi, I also test std::bitset, the memory of this has not meomory leak, here is the test program int main()
} The result is: |
AMDG
This is not a bug. It's the normal behavior of memory allocation.
Allocators do not return memory to the system when it is deallocated,
as that would be horribly inefficient for multiple reasons. Instead,
the freed memory will be reused on the next allocation.
In Christ,
Steven Watanabe
|
Ok, got it, thank you very much. |
Hi,
I am using boost 1.66.0 version, gcc/g++ -7, and I found when using std::vector<boost::dynamic_bitset<>>, it is unable to free memory when destruction, even using function swap(), resize(), reset(). it doesn't work.
The test program is show below
int main()
{
cout << "[ memory start] " << getMemoryUsage();
{
std::vector<boost::dynamic_bitset<>> m_nodes;
m_nodes.resize(1000000 + 1);
uint64_t descriptor[4] = {1, 2, 3, 4};
for(size_t i = 0; i < m_nodes.size(); i++)
{
m_nodes[i] = boost::dynamic_bitset<>(descriptor, descriptor + 4);
}
}
cout << "[ memory end] " << getMemoryUsage() << endl;
}
result is:
[ memory start ] 13
[ memory end ] 59
As the result show:
The memory of boost::dynamic_bitset can not release, so it is the problem.
Could you please confirm it, and tell me how to solve it?
The text was updated successfully, but these errors were encountered: