Commit c9fb3672 authored by Ville Pietilä's avatar Ville Pietilä
Browse files

Clean-up host side destructors.

parent ca4d095b
...@@ -286,7 +286,7 @@ namespace memory { ...@@ -286,7 +286,7 @@ namespace memory {
host_destruct_events_.insert({p, false}); host_destruct_events_.insert({p, false});
} }
void destruct_host(void* p /*, std::function<void()>&& destructor*/) void destruct_host(void* p)
{ {
std::lock_guard<std::mutex> lock(mutex_); std::lock_guard<std::mutex> lock(mutex_);
host_destruct_events_[p] = true; host_destruct_events_[p] = true;
...@@ -330,7 +330,6 @@ namespace memory { ...@@ -330,7 +330,6 @@ namespace memory {
void deallocate(void* p) void deallocate(void* p)
{ {
//destructors_[p]();
host_destruct_events_.erase(p); host_destruct_events_.erase(p);
auto* memory_pool = get_memory_pool(); auto* memory_pool = get_memory_pool();
memory_pool->deallocate(p, allocated_memory_[p]); memory_pool->deallocate(p, allocated_memory_[p]);
...@@ -394,15 +393,7 @@ namespace memory { ...@@ -394,15 +393,7 @@ namespace memory {
void deallocate(T* p, std::size_t) void deallocate(T* p, std::size_t)
{ {
// auto destructor = [&]() { PinnedHostMemoryDeallocator::instance().destruct_host(p);
// if constexpr (std::is_destructible_v<T>)
// {
// for (size_t i = 0; i < n; ++i) {
// p[i].~T();
// }
// }
// };
PinnedHostMemoryDeallocator::instance().destruct_host(p /*, std::move(destructor)*/);
} }
template<typename U, typename... Args> template<typename U, typename... Args>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment