instruments

How to demonstrate memory leak and zombie objects in Xcode Instruments?

天大地大妈咪最大 提交于 2019-12-09 04:32:28
I would like to demonstrate memory leak and zombie object in Xcode Instruments on a class. I've found it pretty hard to trigger on purpose, especially with ARC turned on. Do you know how could I create them? bbum For A leak: Create two classes, A and B. A should have an @property that strongly references an instance of B. B should have an @property that strongly references an instance of A. A *a = [A new]; B *b = [B new]; a.b = b; b.a = a; That'll create a leak. For a Zombie Create a @property that is of type assign (or a variable of type __unsafe_unretained . Then: A *a = [A new]; A

Memory leak checking using Instruments on Mac

时光毁灭记忆、已成空白 提交于 2019-12-09 03:18:37
问题 I've just been pulling my hair out trying to make Instruments cough up my deliberately constructed memory leaks. My test example looks like this: class Leaker { public: char *_array; Leaker() { _array=new char[1000]; } ~Leaker() { } }; void *leaker() { void *p=malloc(1000); int *pa=new int[2000]; { Leaker l; Leaker *pl=new Leaker(); } return p; } int main (int argc, char **argv) { for (int i=0; i<1000; ++i) { leaker(); } sleep(2); // Needed to give Instruments a chance to poll memory return 0

Instruments error: Connection peer refused channel request

前提是你 提交于 2019-12-08 15:29:38
Running Instruments from the command line I started getting this: instruments[2387:30342] Connection peer refused channel request for "com.apple.instruments.server.services.wireless"; channel canceled <DTXChannel: 0x7fa7116b7a10> Any idea what the problem is and how to fix? I'm also doing some research to find out the root cause of the problem. However, making sure Instruments is not running and/or restarting the device solved the issue. 来源: https://stackoverflow.com/questions/28763961/instruments-error-connection-peer-refused-channel-request

Xcode 6 Instruments freeze

送分小仙女□ 提交于 2019-12-08 14:52:10
问题 Profiling my iOS 8 app in Xcode 6 Instruments will run the app for about 5 seconds and then freeze. The profiler will still run after that point but the app is frozen and unusable. Happens on device and simulator and regardless of which profiler I'm using (timer, leaks, etc.) Running the app from the debugger or an ad hoc build works fine. Profiling with iOS 7 works fine as well. Any idea why this may be happening? Is Instruments broken? 回答1: Same issue here: Application hangs when profiling

XCode instruments not reporting any data

戏子无情 提交于 2019-12-08 07:36:42
问题 I'm trying to debug in XCode using the instruments but most of them are not showing any data. I tried this from my home machine and it worked fine, but on my work iMac the following instruments report no data at all: Activity Monitor Allocations Memory Monitor The Leaks instrument seems to be working fine. I am developing an iPad app and am trying to run the instruments with the simulator. XCode version 3.2.3 64-bit Xcode IDE: 1688.0 Xcode Core: 1691.0 ToolSupport: 1591.0 Instruments Version

Instruments automation: iterate for all buttons

你。 提交于 2019-12-08 05:38:47
问题 I'm in the process of automate one of my apps. First I tap on a tabBar =>ok Tap on a 'Add' button of a navigation bar => ok Fill some data of my textFields of my tableView => ok Tap on some cell and open a new ViewController => ok Tap on a 'Add' button in this new controller => nothing happens ... The button is the same as the first view: UIBarButtonSystemItemAdd So, now I want to show all the buttons that automation can find, and iterate and get their names, just to check that all is going

How to demonstrate memory leak and zombie objects in Xcode Instruments?

时光怂恿深爱的人放手 提交于 2019-12-08 03:49:10
问题 I would like to demonstrate memory leak and zombie object in Xcode Instruments on a class. I've found it pretty hard to trigger on purpose, especially with ARC turned on. Do you know how could I create them? 回答1: For A leak: Create two classes, A and B. A should have an @property that strongly references an instance of B. B should have an @property that strongly references an instance of A. A *a = [A new]; B *b = [B new]; a.b = b; b.a = a; That'll create a leak. For a Zombie Create a

Objective C: Detecting Leakages via Instruments in Xcode

假如想象 提交于 2019-12-08 03:08:08
问题 I ran the instruments on my app and found some leaks, however I am not sure how I can decipher the results for example I clicked on the line '_NSArrayM' After which I clicked on one of the entries in the details column and the following was displayed, What does '100%' mean? 回答1: The 100% means all the leaks Instruments detected in that function were in the highlighted line of code. If your function was leaking memory in multiple places, the individual percentages would be lower, but they

Checking iOS application used memory in instruments

萝らか妹 提交于 2019-12-08 03:07:48
问题 I want to make sure I'm reading the allocations plug in correctly. I'm testing an iPad app thats receiving memory warnings 1,2 & 3. I want to know the current used up memory from my app, which I think it has to be the "Live Bytes" column? which marks All Allocations to 2.42 MB which I think its low. What do the other columns report? #Transitory, Overall Bytes ? Also if my app uses only 3 MB of memory can it be killed if I get a memory level 3 warning without releasing? Thank you. 回答1: Don't

Memory Warning but Small Live Bytes

折月煮酒 提交于 2019-12-08 02:07:58
问题 In my application, I get a memory warning of level 1 and then 2 after repeating some action (choosing a picture + processing) several times and then a crash. The leak tool doesn't show any leak. I'm also following the Allocations tool in Instruments and my Live Bytes are roughly 4 MB, overall I allocate 113 MB. At maximum I have maybe 20 MB in memory when the picture is loaded. Since I have to repeat an action to get to the crash, it is very likely to be a memory leak. However, I don't know