access2rohit commented on a change in pull request #14365: Fix memory leak for 
size-zero ndarray
URL: https://github.com/apache/incubator-mxnet/pull/14365#discussion_r264813300
 
 

 ##########
 File path: src/storage/pooled_storage_manager.h
 ##########
 @@ -155,6 +155,10 @@ void GPUPooledStorageManager::Alloc(Storage::Handle* 
handle) {
 }
 
 void GPUPooledStorageManager::Free(Storage::Handle handle) {
+  // Do nothing if dptr is nullptr. Otherwise, nullptr may be reused
+  // which can cause illegal memory access error.
+  if (handle.dptr == nullptr) return;
 
 Review comment:
   👍 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to