anirudh2290 commented on a change in pull request #14480: Tidy up storage 
allocation and deallocation
URL: https://github.com/apache/incubator-mxnet/pull/14480#discussion_r269372917
 
 

 ##########
 File path: tests/cpp/include/test_util.h
 ##########
 @@ -70,11 +70,9 @@ class BlobMemory {
     return handle_.dptr;
   }
   void Free() {
-    if (handle_.dptr) {
-      Storage *storage = mxnet::Storage::Get();
-      storage->DirectFree(handle_);
-      handle_.dptr = nullptr;
-    }
+    mxnet::Storage::Get()->DirectFree(handle_);
+    handle_.size = 0;
+    handle_.dptr = nullptr;
 
 Review comment:
   can you add a test for allocating size 0 blob and checking if handle_.dptr 
== nullptr. Otherwise LGTM

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to