Memory leak when CoreML ML Program is runing on GPU

Overview

MLProgramMemoryLeak

Every layer running on the GPU in ML Program will leak 912 bytes by MPSGraphEngine. This can easily lead to 200KB+ memory leak every time you run a larger model.

Requirements

  • Xcode 13.0+
  • iOS 15.0+

Usage

  1. Build and install the app.
  2. Launch the app in Instruments -> Leaks.
  3. Every time you tap Leak 100KB there should be at least 100 more 912 bytes memory leaks at the next checkpoint of leaks.

Workaround

If you are using a limited number of static models, cache MLModel objects. Otherwise don't use ML Program.

You might also like...
A GPU accelerated image and video processing framework built on Metal.
A GPU accelerated image and video processing framework built on Metal.

MetalPetal An image processing framework based on Metal. Design Overview Goals Core Components MTIContext MTIImage MTIFilter MTIKernel Optimizations C

View Metal GPU information from the command-line.

View Metal GPU information from the command-line.

Get the current frequency of your Apple M1 GPU.

M1-gpufreq Get the current frequency of your Apple M1 GPU. What It Does and How It Works This project is designed to get the current frequency (or clo

An example of using the GPU on M1 arm64 Macs for basic compute functions

M1-GPU-Compute Using Swift and Apple's Metal API to utilize the GPUs on M1 equipped Macs Adding Two Arrays CPUs perform computations sequentially, wai

Patch out the GPU checks for any x86-64 macOS Unreal Engine-based game
Patch out the GPU checks for any x86-64 macOS Unreal Engine-based game

UnrealGPUPatcher Download here Patch out the GPU checks for any x86-64 macOS Unreal Engine-based game, particularly ARK: Survival Evolved. Requirement

SwiftCheck is a testing library that automatically generates random data for testing of program properties

SwiftCheck QuickCheck for Swift. For those already familiar with the Haskell library, check out the source. For everybody else, see the Tutorial Playg

Swift program that creates ASCII art from an image
Swift program that creates ASCII art from an image

Swift ASCII Art Generator Converts an image to text for no good reason. The code is pretty cool, though. It's pure functional Swifty goodness. Take a

A cli program written in swift (with async/await) that removes the unnecessary parts of xcframeworks.

xctrim A cli program written in swift (with async/await) that removes the unnecessary parts of xcframeworks. Usecase Say you downloaded firebase sdk a

Minimal AutoLayout convenience layer. Program constraints succinctly.

MiniLayout Minimal AutoLayout convenience layer. Program constraints succinctly. Usage Put label over textField // using MiniLayout: view.constrain(la

Open Sourced application for Jailbroken device. Program is executing commands on connected iphones

iManager Open Sourced application for Jailbroken device. Program is executing commands on connected iphones Usage Maybe the source code is helping ppl

Genything is a framework for random testing of a program properties.

Genything is a framework for random testing of a program properties. It provides way to random data based on simple and complex types.

JOP is the Json organization program. It can run on any platform that supports Swift.

JOP JOP is a program organized in JSON files. It is based on Swift, provides a syntax similar to Swift, and has the same strong security as Swift. Thi

This project is an application that lets users learn about the missions and astronauts that formed NASA’s Apollo space program.

This project is an application that lets users learn about the missions and astronauts that formed NASA’s Apollo space program.

The program calculates the approximate function to the given graph using the Fourier series
The program calculates the approximate function to the given graph using the Fourier series

Ряды фурье Программа вычисляет приближенную функцию к заданной графиком с помощь

Command line program that detects unused resource strings in an iOS or OS X application.

Abandoned Resource String Detection This command line program detects unused resource strings in an iOS or OS X application. Updated to Swift 3, thank

Ecolande - Application realisé pendant l'Apple foundation Program.

Ecolande Application realisé pendant l'Apple foundation Program. Ecoland est l'application qui a été réalisé pendant l'Apple Foundation Program. Nous

CodePathPrework - The pre-work assignment for the CodePath program. Involves making a tip calculator using XCode.

Pre-work - Tip Calculator Tip Calculator is a tip calculator application for iOS. Submitted by: David Zhu Time spent: 3 hours spent in total User Stor

🎁 Unwrap an optional or throw an error if nil (or crash the program).

Unwrap Or Throw (or Die!) 🎁 Unwrap an optional or throw an error if nil (or crash the program). Not invented here. The idea for unwrap or die and unw

Tip-Calculation- - A program for calculate the tip. You can easily calculate it and you can split money easily
Tip-Calculation- - A program for calculate the tip. You can easily calculate it and you can split money easily

Tip-Calculation- It is a program for calculate the tip. You can easily calculate

Owner
Yi Xie
Chrome OS@Google. iOS fanboy outside work.
Yi Xie
A simple program to fix doubled key presses on macOS using just software

Untap A simple program to fix doubled key presses on macOS using just software. Installation Download this GitHub repo, cd to its folder in Terminal,

BlueCannonBall 1 May 30, 2022
Coreml-performance project works on MacOS to test M1 macbooks

ml-macos-performance This project is inspired by Vladimir Chernykh coreml-performance project for iOS. I made changes so it works on MacOS to test M1

Peter Lin 0 Nov 28, 2021
Profiling / Debugging assist tools for iOS. (Memory Leak, OOM, ANR, Hard Stalling, Network, OpenGL, Time Profile ...)

MTHawkeye Readme 中文版本 MTHawkeye is profiling, debugging tools for iOS used in Meitu. It's designed to help iOS developers improve development producti

meitu 1.4k Dec 29, 2022
Demonstrates a memory leak bug SwiftUI's toolbar APIs exhibit on macOS

Mac SwiftUI Toolbar Memory Leak Demo On Big Sur (macOS 11), SwiftUI's APIs for adding toolbar items to a window have (at least) two bugs around view r

Matt Curtis 6 Aug 6, 2022
CoreML-Face-Parsing - how to use face-parsing CoreML model in iOS

CoreML-Face-Parsing The simple sample how to use face-parsing CoreML model in iO

MLBoy 6 Oct 25, 2022
Automaticly display Log,Crash,Network,ANR,Leak,CPU,RAM,FPS,NetFlow,Folder and etc with one line of code based on Swift. Just like God opened his eyes

GodEye Automaticly display Log,Crash,Network,ANR,Leak,CPU,RAM,FPS,NetFlow,Folder and etc with one line of code based on Swift. Just like God opened hi

陈奕龙(子循) 3.7k Dec 23, 2022
GPUImage 2 is a BSD-licensed Swift framework for GPU-accelerated video and image processing.

GPUImage 2 Brad Larson http://www.sunsetlakesoftware.com @bradlarson [email protected] Overview GPUImage 2 is the second generation of th

Brad Larson 4.8k Dec 29, 2022
GPUImage 3 is a BSD-licensed Swift framework for GPU-accelerated video and image processing using Metal.

GPUImage 3 Janie Clayton http://redqueengraphics.com @RedQueenCoder Brad Larson http://www.sunsetlakesoftware.com @bradlarson contact@sunsetlakesoftwa

Brad Larson 2.4k Jan 3, 2023
An open source iOS framework for GPU-based image and video processing

GPUImage Brad Larson http://www.sunsetlakesoftware.com @bradlarson [email protected] Overview The GPUImage framework is a BSD-licensed iO

Brad Larson 20k Jan 1, 2023
GPU-based media processing library using Metal written in Swift

GPU-based media processing library using Metal written in Swift. Overview MetalAcc is a GPU-Based media processing library that lets you apply GPU-acc

Jiawei Wang 259 Dec 17, 2022