iPhone: Existence of a Memory Leak Profiler?

2019-07-16 09:06发布

问题:

Is there such a thing as a Memory profiler for Iphones apps?

I'd like to know what objects are in memory at any moment.

回答1:

You'll want to use Instruments to profile your App. You can run your app with different templates.

In XCode, select Run > Start With Performance Tool > Object Allocations



回答2:

Shark is a memory profiler that comes with the Apple Developer Tools, it can be used with both iPhone and Mac applications. See: Shark User Guide (iPhone)



回答3:

Technically, I think Apple is phasing out Shark in favor of Instruments. Instruments provides memory profiling tools (allocated objects, leaks, etc...) and can connect to the iPhone Simulator or a remote device to profile iPhone apps. I've never tried to use it to show the actual objects in memory though - just allocation/deallocation activity.