Skip to content

Commit

Permalink
[METAL] Use CFBridgeRetain for retaining the allocated resource (#6393)
Browse files Browse the repository at this point in the history
  • Loading branch information
tqchen authored Sep 4, 2020
1 parent af69e1c commit a2db689
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 a2db689

Please sign in to comment.