diff --git a/src/Amalgam/SeparableBoxFilterDataStore.h b/src/Amalgam/SeparableBoxFilterDataStore.h index 8da33ec5..c9c06b68 100644 --- a/src/Amalgam/SeparableBoxFilterDataStore.h +++ b/src/Amalgam/SeparableBoxFilterDataStore.h @@ -118,7 +118,7 @@ class SeparableBoxFilterDataStore void BuildLabel(size_t column_index, const std::vector &entities); //changes column to/from interning as would yield best performance - void OptimizeColumn(size_t column_ndex); + void OptimizeColumn(size_t column_index); //calls OptimizeColumn on all columns inline void OptimizeAllColumns() diff --git a/src/Amalgam/entity/EntityQueryCaches.cpp b/src/Amalgam/entity/EntityQueryCaches.cpp index 21f37ff4..7342b842 100644 --- a/src/Amalgam/entity/EntityQueryCaches.cpp +++ b/src/Amalgam/entity/EntityQueryCaches.cpp @@ -168,7 +168,7 @@ void EntityQueryCaches::EnsureLabelsAreCached(EntityQueryCondition *cond) lock.unlock(); Concurrency::WriteLock write_lock(mutex); - //now with write_lock, remove any labels that might have already been added by other threads + //now with write_lock, remove any labels that have already been added by other threads labels_to_add.erase(std::remove_if(begin(labels_to_add), end(labels_to_add), [this](auto sid) { return DoesHaveLabel(sid); }), end(labels_to_add)); diff --git a/src/Amalgam/evaluablenode/EvaluableNodeManagement.cpp b/src/Amalgam/evaluablenode/EvaluableNodeManagement.cpp index 20ff24ed..b6b92670 100644 --- a/src/Amalgam/evaluablenode/EvaluableNodeManagement.cpp +++ b/src/Amalgam/evaluablenode/EvaluableNodeManagement.cpp @@ -152,10 +152,10 @@ EvaluableNode *EvaluableNodeManager::AllocListNodeWithOrderedChildNodes(Evaluabl //if don't currently have enough free nodes to meet the needs, then expand the allocation if(num_nodes_needed > num_nodes) { - size_t nodes_to_allocate = static_cast(allocExpansionFactor * num_nodes_needed) + 1; + size_t new_num_nodes = static_cast(allocExpansionFactor * num_nodes_needed) + 1; //fill new EvaluableNode slots with nullptr - nodes.resize(num_nodes + nodes_to_allocate, nullptr); + nodes.resize(new_num_nodes, nullptr); } } @@ -285,7 +285,7 @@ EvaluableNode *EvaluableNodeManager::AllocUninitializedNode() #ifdef MULTITHREAD_SUPPORT //before releasing the lock, make sure it has an allocated type, otherwise it could get grabbed by another thread nodes[firstUnusedNodeIndex]->InitializeUnallocated(); - #endif + #endif } else //allocate if nullptr nodes[firstUnusedNodeIndex] = new EvaluableNode(); @@ -294,10 +294,10 @@ EvaluableNode *EvaluableNodeManager::AllocUninitializedNode() } //ran out, so need another node; push a bunch on the heap so don't need to reallocate as often and slow down garbage collection - size_t nodes_to_allocate = static_cast(allocExpansionFactor * num_nodes) + 1; //preallocate additional resources, plus current node + size_t new_num_nodes = static_cast(allocExpansionFactor * num_nodes) + 1; //preallocate additional resources, plus current node //fill new EvaluableNode slots with nullptr - nodes.resize(num_nodes + nodes_to_allocate, nullptr); + nodes.resize(new_num_nodes, nullptr); if(nodes[firstUnusedNodeIndex] != nullptr) { @@ -335,14 +335,14 @@ void EvaluableNodeManager::FreeAllNodesExceptReferencedNodes() auto &cur_node_ptr = nodes[first_unused_node_index_temp]; //if the node has been found on this iteration and set to the current iteration count, then move on - if(cur_node_ptr->GetGarbageCollectionIteration() == cur_gc_collect_iteration) + if(cur_node_ptr != nullptr && cur_node_ptr->GetGarbageCollectionIteration() == cur_gc_collect_iteration) { first_unused_node_index_temp++; } else //collect the node { //free any extra memory used, since this node is no longer needed - if(cur_node_ptr->GetType() != ENT_DEALLOCATED) + if(cur_node_ptr != nullptr && cur_node_ptr->GetType() != ENT_DEALLOCATED) cur_node_ptr->Invalidate(); //see if out of things to free; if so exit early