Skip to content

Commit

Permalink
hackathon updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kab163 committed Aug 29, 2024
1 parent 8500d8c commit e50d947
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/umpire/Allocator.inl
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@ inline void* Allocator::thread_safe_allocate(std::size_t bytes)
return do_allocate(bytes);
}

// TODO: Do I need a thread safe resource allocate?
inline void* Allocator::thread_safe_resource_allocate(camp::resources::Resource const& r, std::size_t bytes)
{
// std::lock_guard<std::mutex> lock(*m_thread_safe_mutex);
std::lock_guard<std::mutex> lock(*m_thread_safe_mutex);
return do_resource_allocate(r, bytes);
}

Expand All @@ -72,10 +71,9 @@ inline void Allocator::thread_safe_deallocate(void* ptr)
return do_deallocate(ptr);
}

// TODO: Do I need a thread safe resource deallocate?
inline void Allocator::thread_safe_resource_deallocate(camp::resources::Resource const& r, void* ptr)
{
// std::lock_guard<std::mutex> lock(*m_thread_safe_mutex);
std::lock_guard<std::mutex> lock(*m_thread_safe_mutex);
return do_resource_deallocate(r, ptr);
}

Expand Down Expand Up @@ -116,7 +114,6 @@ inline void* Allocator::do_resource_allocate(camp::resources::Resource const& r,
ret = m_allocator->allocate_resource(r, bytes);
}

// TODO: track the resource?
if (m_tracking) {
registerAllocation(ret, bytes, m_allocator);
}
Expand Down Expand Up @@ -192,7 +189,6 @@ inline void Allocator::deallocate(void* ptr)
m_thread_safe ? thread_safe_deallocate(ptr) : do_deallocate(ptr);
}

// TODO: Create thread safe resource deallocate?
inline void Allocator::deallocate(camp::resources::Resource const& r, void* ptr)
{
m_thread_safe ? thread_safe_resource_deallocate(r, ptr) : do_resource_deallocate(r, ptr);
Expand Down
1 change: 1 addition & 0 deletions src/umpire/strategy/ResourceAwarePool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ void ResourceAwarePool::do_deallocate(Chunk* chunk) noexcept
it++;
}
}

chunk->size_map_it = m_free_map.insert(std::make_pair(chunk->size, chunk));
chunk->free = true;
}
Expand Down

0 comments on commit e50d947

Please sign in to comment.