This commit is contained in:
Siarhei Fedartsou 2024-07-11 19:33:45 +02:00
parent 058c26e39a
commit c5aae5148e
2 changed files with 3 additions and 6 deletions

View File

@ -20,7 +20,8 @@ using ContractorHeap = util::QueryHeap<NodeID,
NodeID,
EdgeWeight,
ContractorHeapData,
util::XORFastHashStorage<NodeID, NodeID>>;
util::XORFastHashStorage<NodeID, NodeID>,
false>;
} // namespace osrm::contractor

View File

@ -23,13 +23,12 @@ class MemoryManager
public:
static MemoryManager &instance()
{
thread_local MemoryManager instance;
static thread_local MemoryManager instance;
return instance;
}
T *allocate(std::size_t n)
{
std::lock_guard<std::mutex> lock(mutex_);
size_t free_list_index = get_next_power_of_two_exponent(n);
auto &free_list = free_lists_[free_list_index];
const auto items_in_block = 1u << free_list_index;
@ -52,7 +51,6 @@ public:
void deallocate(T *p, std::size_t n) noexcept
{
std::lock_guard<std::mutex> lock(mutex_);
size_t free_list_index = get_next_power_of_two_exponent(n);
free_lists_[free_list_index].push_back(p);
}
@ -66,8 +64,6 @@ public:
}
private:
std::mutex mutex_;
MemoryManager() = default;
MemoryManager(const MemoryManager &) = delete;
MemoryManager &operator=(const MemoryManager &) = delete;