-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
I suggest the last segment in the pool is kept and not freed when empty. Since the segment will only be allocated when the user actually first allocates something, this will not result in useless RAM usage, and will make sure that the future allocations are faster in an allocate-free code scenario. Otherwise you have to specify m_never_free, which is a bit harsh: we'd like to keep the heaps under control and optimize the performance.
void free(block_type const& b)
{
b.m_segment->free(b);
if (!m_never_free && b.m_segment->is_empty())
{
std::lock_guard<std::mutex> lock(m_mutex);
// THIS IS THE CHANGE
if (b.m_segment->is_empty() && m_segments.size()>1) m_segments.erase(b.m_segment);
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels