Instruments

RSS for tag

Instruments is a performance-analysis and testing tool for iOS, iPadOS, watchOS, tvOS, and macOS apps.

Instruments Documentation

Post

Replies

Boosts

Views

Activity

Xcode Instruments selects wrong application when started from Xcode
Hello, I see the Instruments app has gotten a nice upgrade for Xcode 16. There is one issue left that has been bothering me though. If my app is installed inside the "Application" folder, and I then try to launch Instruments for a new build of the same app from within XCode, Instruments will run the app installed in "Applications" instead of running the app I just built. The problem with this, is that it's very easy to accidentally profile an old version of your app, and come to the wrong conclusions. I've created a video showing this issue: https://youtu.be/IloFsQQFgSw
1
0
93
4d
xctrace record symbolicate failed
When using instruments leaks to record a trace, and then using the xctrace symbolicate command to symbolize it, it will prompt that the symbol file cannot be found. record command like this: ‘ xctrace record --instrument Leaks XXXXXXXX", only use --instrument parameter nor --template parameter. symbolicate commadn like this: 'xctrace symbolicate --input xx.trace --output ddd. trace --dsym /Users/xxxx/Downloads/dSYM' Below is the symbol translation error message: Gathering trace symbols info [2/2] Succeeded: 2/2 [Error] Cannot resymbolicate this trace: No dSYMs were found or relevant to this trace.
0
0
70
1w
xctrace record save file crash
when i use command of xctrace to record allocations data , the xctrace save crash . command like this : 'xctrace record --template Leaks xxxxxxxxx" The problem has been going on for a long time。 The following is the xctrace exception information: Starting recording with the Leaks template. Launching process: *** Recording completed. Saving output file... *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[XRSharingArchiver encodeDataObject:]: data length (2923248118) makes data too large to fit in non-keyed archive' *** First throw call stack: ( 0 CoreFoundation 0x0000000199ab32ec __exceptionPreprocess + 176 1 libobjc.A.dylib 0x000000019959a788 objc_exception_throw + 60 2 Foundation 0x000000019b206cdc -[NSArchiver encodeDataObject:] + 252 3 Foundation 0x000000019ac162b4 _encodeObject_old + 144 4 Foundation 0x000000019ab5def4 -[NSDictionary(NSDictionary) encodeWithCoder:] + 388 5 Foundation 0x000000019ac162b4 _encodeObject_old + 144 6 DVTInstrumentsAnalysisCore 0x000000010168bb2c _ZN23_XRStorageManagerAccess26_invokeFieldWriteForStreamERK28_XRStorageManagerAccessTokenR23_XRStorageManagerCursorU13block_pointerFvU13block_pointerFvjPKvzEE + 113272 7 Foundation 0x000000019ac162b4 _encodeObject_old + 144 8 Foundation 0x000000019ab5def4 -[NSDictionary(NSDictionary) encodeWithCoder:] + 388 9 Foundation 0x000000019ac162b4 _encodeObject_old + 144 10 DVTInstrumentsAnalysisCore 0x000000010164d9c0 XRSentinelSignatureFromEType + 101760 11 Foundation 0x000000019ac162b4 _encodeObject_old + 144 12 MemoryPlugin 0x0000000101235854 MemoryPlugin + 38996 13 Foundation 0x000000019ac162b4 _encodeObject_old + 144 14 InstrumentsPlugIn 0x0000000101e225d8 -[XRSharedArchiveObject encodeWithCoder:] + 468 15 Foundation 0x000000019ac162b4 _encodeObject_old + 144 16 MemoryPlugin 0x0000000101231064 MemoryPlugin + 20580 17 Foundation 0x000000019ac162b4 _encodeObject_old + 144 18 InstrumentsPlugIn 0x0000000101dd35fc -[XRTrace saveDocument:error:] + 3388 19 XCTraceCore 0x0000000101550a54 __swift_memcpy48_8 + 53592 20 XCTraceCore 0x00000001015451b8 __swift_memcpy48_8 + 6332 21 XCTraceCore 0x000000010154470c __swift_memcpy48_8 + 3600 22 xctrace 0x0000000100fcf814 xctrace + 14356 23 dyld 0x00000001995d60e0 start + 2360 ) libc++abi: terminating due to uncaught exception of type NSException
0
0
75
1w
App Store Connect / Trends issue
Hello, anyone deal with an issue in the App Store Connect (trends section)? Few hours ago I logged in and checked the trends page, but it does not load. It takes a while and then the error: "An unexpected error occurred. Try reloading the page. If the problem persists ..." is being shown I guess it's an Apple issue or am I the only one experiencing this problem? Best, Jackson
4
0
305
1w
instruments Error using CLI
While running instruments using CLI we are seeing below error: command: xcrun xctrace record --template Leaks --launch application --output recording.trace -e DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib Run issues were detected (trace is still ready to be viewed): [Error] An error occurred trying to capture Leaks data. [Error] Failed to generate memory graph for pid 7828: failed to create a VMUTaskMemoryScanner, probably because the target's libmalloc hasn't been initialized Recording failed with errors. Saving output file... System details: Xcode 15.4 Mac :Intel processors MacOs:14.5
0
0
118
1w
Really High Energy Use
I'm developing an app where users can select items to add to a screen, similar to creating a Canva presentation or choosing blocks in Minecraft. However, I'm encountering an issue with energy usage. When users click the arrows to browse different items, the energy use spikes significantly. Although it returns to normal after a while, continuous clicking causes the energy use to skyrocket. The images I'm using are 500x500 pixels. Ideally, I would like to avoid caching all the images, as the app might have up to 500 items and caching them all would consume too much memory. I have tried numerous way to avoid this but I just can’t seem to make it work. Would anyone know how to avoid such problem? I have included a picture of the energy use when just opened, and one after like 10 seconds of continuously clicking on an arrow to see more items. Also a picture of how the app looks. struct ContentView: View { struct babyBackground { var littleImage = "" } @State var firstSet: [babyBackground] = [ babyBackground(littleImage: "circle"), babyBackground(littleImage: "square"), babyBackground(littleImage: "triangle"), babyBackground(littleImage: "anotherShape"), babyBackground(littleImage: "circle"), babyBackground(littleImage: "square"), babyBackground(littleImage: "triangle"), babyBackground(littleImage: "anotherShape") ] @State var secondSet: [babyBackground] = [ babyBackground(littleImage: "circle"), babyBackground(littleImage: "square"), babyBackground(littleImage: "triangle"), babyBackground(littleImage: "anotherShape"), babyBackground(littleImage: "circle"), babyBackground(littleImage: "square"), babyBackground(littleImage: "triangle"), babyBackground(littleImage: "anotherShape"), babyBackground(littleImage: "circle") ] @State var thirdSet: [babyBackground] = [ babyBackground(littleImage: "circle"), babyBackground(littleImage: "square"), babyBackground(littleImage: "triangle"), ] let columns: [GridItem] = Array(repeating: .init(.flexible()), count: 4) func createBackgroundGridView(for backgrounds: [babyBackground], columns: [GridItem] ) -> some View { LazyVGrid(columns: columns, spacing: 10) { ForEach(0..<backgrounds.count, id: \.self) { index in Button(action: { }, label: { if let path = Bundle.main.path(forResource: backgrounds[index].littleImage, ofType: "png"), let uiImage = UIImage(contentsOfFile: path) { Image(uiImage: uiImage) .resizable() .frame(width: 126, height: 96) } }) } } .padding() } @State var indexOn = 0 var body: some View { HStack{ Button(action: { indexOn = (indexOn == 0) ? 2 : indexOn - 1 }) { Label("", systemImage: "arrowtriangle.left.fill") .font(.system(size: 50)) } Spacer() ScrollView { switch indexOn { case 0: createBackgroundGridView(for: firstSet, columns: columns) case 1: createBackgroundGridView(for: secondSet, columns: columns) case 2: createBackgroundGridView(for: thirdSet, columns: columns) case 3: createBackgroundGridView(for: thirdSet, columns: columns) default: createBackgroundGridView(for: firstSet, columns: columns) } } .frame(maxWidth: .infinity, maxHeight: .infinity) Spacer() Button(action: { indexOn = (indexOn == 2) ? 0 : indexOn + 1 }) { Label("", systemImage: "arrowtriangle.right.fill") .font(.system(size: 50)) } } } } Energy Use when app starts: Energy use after clicking for about 10 seconds: App UI:
1
1
135
2w
Error attaching to the pid
Hi 👋 I need assistance in attaching the to the pid in terminal. In lldb mode I am connecting to the pid using device process attach --pid <pid-id> which gives me an error Process 505 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP frame #0: 0x00000001d505c808 libsystem_kernel.dylib`mach_msg2_trap + 8 libsystem_kernel.dylib`mach_msg2_trap: -> 0x1d505c808 <+8>: ret Thanks
1
0
209
2w
Instruments false positives
I have been able to get rid of reported memory leaks in Instruments not by fixing a leak but by adding some lines (like releasing a previous nil object) that convinced Instruments it is not a leak. But I am stuck are some I cannot stop Instruments from reporting. It reports a leak in this code if(expr.length&gt;0) { // add previous Atomic Atomic *atom = [[Atomic alloc] initWithString:[string substringWithRange:expr] isNumber:aNum]; [exprTokens addObject:atom]; [atom release]; } } and it underlines the substringWithRange method. I changed code to explicitly release atom and I assumed substringWithRange would return an autoreleased new string. I am aware Instruments tells you where the leaked object is created and not where it is leak, but only things created here are atom and a sub string and atom is released immediately. The initWithString method might do it, but I don't find anything there. Also, while running instruments, this code is 8542 times (I am pretty sure always in the same context) and Instruments says it only leaks 61 times. I don't now if there is misunderstanding are a code problem?
1
0
201
2w
iOS 18 isn't an option to run my app in simulator - xcode 16 beta
what could be the reason? i open my app in xcode 16. build completes successfully. i am only given the options to simulate in iOS 17, 17.2 or 17.5. none of the devices show the option to run in iOS 18. but i am able to go into the simulator and through file and open the iOS 18 simulator. just not able to run my app in there. my app is set in xcode to run with a minimum of iOS 16. any ideas?
1
1
775
Jun ’24
unable to find utility "instruments"
I am building an old app with very old dependencies on the new xcode. Download xcode 14.2 or below looks like a solution. I am not sure if that's possible. Building for simulators fail because of arm64. Phone is my only option. When using `react-native run-ios --device' it fails with sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find instruments 2> /dev/null' failed with exit code 17664: (null) (errno=No such file or directory) xcrun: error: unable to find utility "instruments", not a developer tool or in PATH. Here is my configuration System: OS: macOS 14.5 CPU: (8) arm64 Apple M2 Memory: 244.50 MB / 16.00 GB Shell: Unknown Binaries: Node: 16.20.0 - ~/.nvm/versions/node/v16.20.0/bin/node Yarn: 3.6.4 - /opt/homebrew/bin/yarn npm: 8.19.4 - ~/.nvm/versions/node/v16.20.0/bin/npm Watchman: 2024.05.06.00 - /opt/homebrew/bin/watchman SDKs: iOS SDK: Platforms: DriverKit 23.5, iOS 17.5, macOS 14.5, tvOS 17.5, visionOS 1.2, watchOS 10.5 IDEs: Android Studio: 2022.2 AI-222.4459.24.2221.9971841 Xcode: 15.4/15F31d - /usr/bin/xcodebuild npmPackages: react: 16.8.6 => 16.8.6 react-native: 0.60.4 => 0.60.4
2
0
284
Jun ’24
Memory profiler crash on running profile for debugging WKWebKit crash
We are getting crash issue in our WKWebkit based Cordova application due to memory issues. However, for debugging the memory issue we are trying to use JavaScript allocations in the memory profiler of instruments. and while using it, the profiler automatically closes within few seconds, and we are not able to debug the underlaying memory issue in the WKWebKit. I
4
0
306
Jun ’24
Testflight and AppStore installation fails
I'm working on this Mac Safari extension https://apps.apple.com/app/id6464076425 The installation of the app via Testflight stops without any success (only for me) As well as the installation via AppStore. This happens only to me. I tried it on another computer, and it installed successfully. Here are some videos: This makes the development and release process impossible until I solve this problem. I tried all the methods I could find online, such as: Deleting the currently installed app Restarting Safari Restarting my Mac Is there anything else I can do to fix this problem?
0
0
295
Jun ’24
Is it possible to run instruments an App without being connected to Xcode?
I'm currently supporting an app where one of the dependencies we use had an update. The app is an iPad only app that is meant to be run as a kiosk (guided access, single app mode). After the dependency update for the casing of the tablet / kiosk, we noticed an uptick in errors that may or may not have been associated with the recent 3rd party software update. I wanted to verify if the update had an impact on our production kiosks. To get a good idea of whether or not the update for casework's library had a negative impact, though, I would need to run instruments on a tablet while it's in the case. There's only one power cable to the iPad and the cable that would be used to connect directly to a Mac / Xcode is the same cable that connects to the casework. Is it possible to run instruments, and then retrieve data, from an app that's not directly connected to Xcode? Or is it possible for Xcode to somehow connect via a running instance of an app remotely?
1
0
450
May ’24
Unknown network connection Xcode instruments
Users have reported unusually high data usage with my app. So to investigate I have profiled in instruments. My app as expected in using minimal data. However in instruments I see an "Unknown" process. Which sends around 1mb of data every 2 seconds. Can anyone explain what unknown process is? Sorry my question is vague but I'm at the beginning of understanding the instruments outputs so your help is so very much appreciated.
1
0
404
May ’24