Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automate iOS memory leak detection with instrumentation in Terminal

I have requirements where I need to automate detection of following in iOS project:

  • Detection of memory leak
  • Detection of abandoned or objects which grows without being released and causes app to crash

And all this should be done in terminal so I can use it in Bamboo.

Basically I have app which will run for long time(for example 24 hours). I can start it using instruments to launch up with memory leak template. But I am having hard time to figure out the way where I can parse it find out what other objects are leaking and growing without being released.

Just to summarise right now I launch instrumentation tool with leak profile manually stop the app and then manually going through the result to check if objects are not leaking so I want to automate it by running commands in terminal.

I will appreciate any help. Thank you in advance.

like image 841
user2479042 Avatar asked Oct 20 '22 07:10

user2479042


1 Answers

Instruments can profile apps via terminal and you can specify

  • -t profiling template
  • -D path where to store .trace file with measured output

For reading .trace files use TraceUtility which enables you to parse out useful information about some of instruments like: time profiler, allocations, connections and now also memory leaks.

For practical example check out article where we described how to automate whole pipeline that

  1. run UI test
  2. profile with Instruments
  3. parse .trace files
  4. determine new memory leaks
like image 156
user2021120 Avatar answered Oct 23 '22 03:10

user2021120