You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/09/03 21:09:29 UTC

[GitHub] [incubator-tvm] vathysjacob commented on issue #6376: [BUG] Memory leak in Metal runtime device api

vathysjacob commented on issue #6376:
URL: https://github.com/apache/incubator-tvm/issues/6376#issuecomment-686766012


   @tqchen - negative on #6393, memory usage continues to increase.
   
   It looks like if manual reference counting is used, setPurgeableState needs to be set to empty before MTLBuffer will be released.
   
   The following clears up a bulk of the retained memory allocations for me, I'll need to take a look more closely to see what else may be being retained. With this change, memory is now ticking up on the order of 10s of KB when reloading a model instead of the ~22MB I saw previously:
   
   ```
   void MetalWorkspace::FreeDataSpace(TVMContext ctx, void* ptr) {
     // release the ptr.
   + [(id<MTLBuffer>)ptr setPurgeableState:MTLPurgeableStateEmpty];
     CFRelease(ptr);
   }
   ```
   
   FYI - if it is relevant:
   - I'm building for iOS 13.6
   - Objective-C Automatic Reference Counting is set to No in the project build settings based on the settings used in the tvmrpc  project.


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