Make sure no vector reallocation will be performed on pillars.
This is a workaround for now, it needs to be handled properly.
This commit is contained in:
parent
c4d50ea639
commit
fefde79c89
1 changed files with 3 additions and 2 deletions
|
@ -309,7 +309,7 @@ public:
|
||||||
{
|
{
|
||||||
std::lock_guard<Mutex> lk(m_mutex);
|
std::lock_guard<Mutex> lk(m_mutex);
|
||||||
if (m_pillars.capacity() < m_heads.size())
|
if (m_pillars.capacity() < m_heads.size())
|
||||||
m_pillars.reserve(m_heads.size() * 2);
|
m_pillars.reserve(m_heads.size() * 10);
|
||||||
|
|
||||||
assert(headid >= 0 && headid < m_head_indices.size());
|
assert(headid >= 0 && headid < m_head_indices.size());
|
||||||
Head &head = m_heads[m_head_indices[size_t(headid)]];
|
Head &head = m_heads[m_head_indices[size_t(headid)]];
|
||||||
|
@ -360,7 +360,8 @@ public:
|
||||||
{
|
{
|
||||||
std::lock_guard<Mutex> lk(m_mutex);
|
std::lock_guard<Mutex> lk(m_mutex);
|
||||||
if (m_pillars.capacity() < m_heads.size())
|
if (m_pillars.capacity() < m_heads.size())
|
||||||
m_pillars.reserve(m_heads.size() * 2);
|
m_pillars.reserve(m_heads.size() * 10);
|
||||||
|
|
||||||
m_pillars.emplace_back(std::forward<Args>(args)...);
|
m_pillars.emplace_back(std::forward<Args>(args)...);
|
||||||
Pillar& pillar = m_pillars.back();
|
Pillar& pillar = m_pillars.back();
|
||||||
pillar.id = long(m_pillars.size() - 1);
|
pillar.id = long(m_pillars.size() - 1);
|
||||||
|
|
Loading…
Reference in a new issue