tqchen commented on code in PR #16066:
URL: https://github.com/apache/tvm/pull/16066#discussion_r1381977764


##########
src/runtime/memory/memory_manager.cc:
##########
@@ -166,6 +167,12 @@ Allocator* MemoryManager::GetAllocator(Device dev, 
AllocatorType type) {
   return it->second.at(type).get();
 }
 
+void MemoryManager::Clear() {
+  MemoryManager* m = MemoryManager::Global();
+  std::lock_guard<std::mutex> lock(m->mu_);
+  m->allocators_.clear();

Review Comment:
   let us iterate over each allocator and clear each of the freed entries, as 
oppose to clear the vector, which can cause issues when some of the allocated 
storage from the allocators get retained and deleted after clear



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to