12

I migrated a project from the previous version of Xcode to Xcode 8. What I want is to use the new visual memory debugger. It's available in new projects, but is entirely missing in my imported one. Why is this?

PopKernel
  • 4,110
  • 5
  • 29
  • 51

5 Answers5

12

It appears that Swift 3 is required for Visual Memory Debugger to work.

My app migrated to Swift 2.3 did not work, when I tried migrating it to Swift 3.0 it worked instantly.

The runtime sanitization checkbox is not required for visual memory debugger to work, however the reason that it is disabled is the same.

gabriellanata
  • 3,946
  • 2
  • 21
  • 27
  • 5
    Confirmed in the [Xcode 8.0 beta release notes](http://adcdownload.apple.com/WWDC_2016/Xcode_8_beta/Release_Notes_for_Xcode_8_beta.pdf): "Please note that several new features in Xcode 8 are not supported for projects that use Swift 2.3. These include: • Memory graph debugging • Address Sanitizer • Thread Sanitizer • Core Data build-time code generation To be able to use these features you must migrate your Swift code to Swift 3. (26003920)" – zpasternack Jun 15 '16 at 07:56
7

It seems like the project requires Swift 3 to enable Adress & Thread Sanitizer (which is the Memory Debugger).

address sanitizer thread sanitizer

For me this applies to both iOS & OS X/macOS apps. Both written in Swift 2.2 & converted to 2.3.

Note: I only tested this on OS X El Capitan 10.11.5.

@gabriellanata confirms that it works when the code is converted to Swift 3.

mangerlahn
  • 4,746
  • 2
  • 26
  • 50
  • 1
    Memory debugger is not compatible with the thread sanitizer. You can't run both at the same time. – tzm41 May 03 '17 at 23:23
0

I just ran an Objective-C iOS 7 project made with Xcode 7 in Xcode 8 (without migrating) and the Visual Memory Debugger icon appears at the bottom of Xcode in the debugging area next to the Debug View Hierarchy button.

Visual memory Debugger

It's the button with the three circles.

From the other comments, it looks like Swift 3 might be required to use this feature.

JAL
  • 41,701
  • 23
  • 172
  • 300
  • It's not there. Maybe it has something to do with my project being a mac app? – PopKernel Jun 14 '16 at 22:57
  • Hmm, maybe. What version of OS X were you targeting before and what version of Xcode was the project created with? – JAL Jun 14 '16 at 22:58
  • 1
    wait, what about "runtime sanitation"? it's toggled on in the scheme of new projects, but not in mine. It's greyed out, saying "requires recompilation" – PopKernel Jun 14 '16 at 22:59
  • @PopKernel Thanks, let me do some more digging. – JAL Jun 14 '16 at 23:02
  • did you figure it out? having the same problem – gabriellanata Jun 15 '16 at 03:58
  • @gabriellanata iOS app or macOS app? – JAL Jun 15 '16 at 04:00
  • iOS app. Originally on Swift 2.2 and migrated to Swift 2.3. Old minimum OS target was 8.0, tried increasing to 10.0 bit it still does not work. I have the "runtime sanitation" toggle grayed out too and I cannot figure out how to enable it. – gabriellanata Jun 15 '16 at 04:02
  • 2
    The memory debugger also requires that you use a 64-bit target for iOS builds. Took a bit to figure out the iPad 2 sim was selected in my environment -- changed to iPad Air 2 and the Debug Memory Graph button appeared. – savvyx4 Aug 03 '16 at 03:49
  • It works for me with Objective-C project in `Version 8.0 beta 5 (8S193k)` – Iulian Onofrei Aug 12 '16 at 11:56
0
Argument '-sanitize=address' is not supported on the Swift 2.3 toolchain. 
You will need to migrate your project to Swift 3 to use this feature.

Xcode 8 GM build error

P.S. Objective-c supported by Visual Memory Debugger

Uladzimir
  • 3,067
  • 36
  • 30
0

If you click on Memory, the source editor pane will change to show some memory information, including why it's disabled. In my case, it was because I had Zombie Objects enabled in the Scheme. (Xcode 8.3.2)

Rick
  • 3,298
  • 3
  • 29
  • 47