1
0
Fork 0

invalidate bucket data

This commit is contained in:
jsteemann 2016-08-26 14:53:37 +02:00
parent c44649da00
commit 0fe0e89a89
2 changed files with 21 additions and 4 deletions

View File

@ -517,9 +517,18 @@ class AssocMulti {
try {
for (size_t i = 0; i < _buckets.size(); ++i) {
empty.emplace_back(new EntryType[static_cast<size_t>(_initialSize)]);
auto newBucket = new EntryType[static_cast<size_t>(_initialSize)];
for (IndexType j = 0; j < _initialSize; ++j) {
newBucket[j].ptr = nullptr;
newBucket[j].next = INVALID_INDEX;
newBucket[j].prev = INVALID_INDEX;
if (useHashCache) {
newBucket[j].writeHashCache(0);
}
}
empty.emplace_back(newBucket);
}
size_t i = 0;
for (auto& b : _buckets) {
invokeOnAllElements(callback, b);

View File

@ -334,9 +334,17 @@ class AssocUnique {
std::vector<Element**> empty;
empty.reserve(_buckets.size());
try {
try {
uint64_t const nrAlloc = initialSize();
for (size_t i = 0; i < _buckets.size(); ++i) {
empty.emplace_back(new Element*[static_cast<size_t>(initialSize())]);
auto newBucket = new Element*[static_cast<size_t>(nrAlloc)];
for (uint64_t j = 0; j < nrAlloc; ++j) {
newBucket[j] = nullptr;
}
empty.emplace_back(newBucket);
}
size_t i = 0;