Skip to content

Commit

Permalink
[METAL] Use CFBridgeRetain for retaining the allocated resource (apac…
Browse files Browse the repository at this point in the history
  • Loading branch information
tqchen authored and trevor-m committed Sep 18, 2020
1 parent c29d491 commit 8cee105
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/runtime/metal/metal_device_api.mm
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand Down Expand Up @@ -159,7 +160,7 @@ int GetWarpSize(id<MTLDevice> dev) {
*/
id<MTLBuffer> buf = [dev newBufferWithLength:nbytes options:storage_mode];
CHECK(buf != nil);
return (__bridge void*)([buf retain]);
return (void*)(CFBridgingRetain(buf));
}

void MetalWorkspace::FreeDataSpace(TVMContext ctx, void* ptr) {
Expand Down

0 comments on commit 8cee105

Please sign in to comment.