小编Foo*_*Bar的帖子

如何找到 NSString 使用的内存?

我在查看 NSString 使用的内存时卡住了:

我的 NSString theKey 在 lldb 中显示正常:

(lldb) p *theKey
(NSString) $5 = {
  NSObject = {
    isa = __NSCFConstantString
  }
}
Run Code Online (Sandbox Code Playgroud)

内容可见:

(lldb) po theKey
BBBBBBBBBB
Run Code Online (Sandbox Code Playgroud)

我也得到了 NSString 对象的内存:

(lldb) fr v
(ViewController *const) self = 0x0897eb10
(SEL) _cmd = "viewDidLoad"
(NSString *) theKey = 0x00004664 @"BBBBBBBBBB"
Run Code Online (Sandbox Code Playgroud)

当关于 NSString 对象的内存时,我只会得到奇怪的值:

(lldb) memory read 0x00004664
0x00004664: 50 93 87 01 c8 07 00 00 68 37 00 00 0b 00 00 00  P.......h7......
0x00004674: 50 93 87 01 …
Run Code Online (Sandbox Code Playgroud)

iphone macos xcode objective-c ios

2
推荐指数
1
解决办法
702
查看次数

标签 统计

ios ×1

iphone ×1

macos ×1

objective-c ×1

xcode ×1