From 8cee105e4901962fede0193ba462dca83a3b5d05 Mon Sep 17 00:00:00 2001 From: Tianqi Chen Date: Thu, 3 Sep 2020 18:03:36 -0700 Subject: [PATCH] [METAL] Use CFBridgeRetain for retaining the allocated resource (#6393) --- src/runtime/metal/metal_device_api.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/runtime/metal/metal_device_api.mm b/src/runtime/metal/metal_device_api.mm index fddeadf86f62..0082cddcd809 100644 --- a/src/runtime/metal/metal_device_api.mm +++ b/src/runtime/metal/metal_device_api.mm @@ -1,3 +1,4 @@ + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -159,7 +160,7 @@ int GetWarpSize(id dev) { */ id 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) {