diff --git a/metal/paddle-mobile/paddle-mobile/Net.swift b/metal/paddle-mobile/paddle-mobile/Net.swift index 1c90d04fe664c3a72e4e3cba66239208a1071581..ce9ec98a66e685eec3a688a5a29402a76567b0e2 100644 --- a/metal/paddle-mobile/paddle-mobile/Net.swift +++ b/metal/paddle-mobile/paddle-mobile/Net.swift @@ -24,7 +24,7 @@ public class ResultHolder: NSObject { capacity = inCapacity } - public func releasePointer() { + @objc public func releasePointer() { result?.deinitialize(count: capacity) result?.deallocate() } diff --git a/metal/paddle-mobile/paddle-mobile/PaddleMobileGPU.m b/metal/paddle-mobile/paddle-mobile/PaddleMobileGPU.m index cb989123bb8edbe962959aa3e4438d67e98d05dc..48f39d0b1bd9f5258712fac40f80668d879bb0b1 100644 --- a/metal/paddle-mobile/paddle-mobile/PaddleMobileGPU.m +++ b/metal/paddle-mobile/paddle-mobile/PaddleMobileGPU.m @@ -49,6 +49,7 @@ [resultArray addObject:[NSNumber numberWithFloat:result.result[i]]]; } completion(success, resultArray); + [result releasePointer]; }]; // [runner predictWithTexture:texture completion:completion];