wip
This commit is contained in:
parent
058c26e39a
commit
c5aae5148e
@ -20,7 +20,8 @@ using ContractorHeap = util::QueryHeap<NodeID,
|
|||||||
NodeID,
|
NodeID,
|
||||||
EdgeWeight,
|
EdgeWeight,
|
||||||
ContractorHeapData,
|
ContractorHeapData,
|
||||||
util::XORFastHashStorage<NodeID, NodeID>>;
|
util::XORFastHashStorage<NodeID, NodeID>,
|
||||||
|
false>;
|
||||||
|
|
||||||
} // namespace osrm::contractor
|
} // namespace osrm::contractor
|
||||||
|
|
||||||
|
@ -23,13 +23,12 @@ class MemoryManager
|
|||||||
public:
|
public:
|
||||||
static MemoryManager &instance()
|
static MemoryManager &instance()
|
||||||
{
|
{
|
||||||
thread_local MemoryManager instance;
|
static thread_local MemoryManager instance;
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
T *allocate(std::size_t n)
|
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);
|
size_t free_list_index = get_next_power_of_two_exponent(n);
|
||||||
auto &free_list = free_lists_[free_list_index];
|
auto &free_list = free_lists_[free_list_index];
|
||||||
const auto items_in_block = 1u << 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
|
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);
|
size_t free_list_index = get_next_power_of_two_exponent(n);
|
||||||
free_lists_[free_list_index].push_back(p);
|
free_lists_[free_list_index].push_back(p);
|
||||||
}
|
}
|
||||||
@ -66,8 +64,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::mutex mutex_;
|
|
||||||
|
|
||||||
MemoryManager() = default;
|
MemoryManager() = default;
|
||||||
MemoryManager(const MemoryManager &) = delete;
|
MemoryManager(const MemoryManager &) = delete;
|
||||||
MemoryManager &operator=(const MemoryManager &) = delete;
|
MemoryManager &operator=(const MemoryManager &) = delete;
|
||||||
|
Loading…
Reference in New Issue
Block a user