Xcode/Instruments' "Gather leaked memory contents" gives me a useless hex-only dump
When using the "Gather Leaked Memory Contents" of the Leaks Instrument, it seems to giv开发者_如何学运维e me only the hex contents of an object, rather than showing me the ASCII string beside it (like every other hex dump in the world ever). Worse still, this box is un-selectable, I cannot even copy it into a decent hex editor for a string view.
Is there a reason for such insanity?
One way to find the contents is by running leaks from the command-line. Find the process name of your running app (you can use a tool such as from Activity Monitor or top), then in Terminal run:
leaks myprocessname
It should print out not only the address, size, and type of data, but the contents as well if it can. You can also, of course, copy the result from there into whatever hex editor you fancy.
Because the point of the Leaks instrument is to show you where things are being leaked, which is far more useful than what. When you know where and when things are leaked, go back to Xcode, set breakpoints, and step through. If what's being leaked is important to why, then you can see that in the debugger in real time, rather than in Instruments after the fact in aggregate.
精彩评论