ios - How to check heap memory using instruments in Xcode? -


i trying analyse leaks using instruments in xcode. here sample code trying with.

+(nsstring *) getuniquefilename { nsdate *time = [nsdate date]; nsdateformatter* df = [nsdateformatter new]; [df setdateformat:@"mmddyyyyhhmmsssss"]; nsstring *timestring = [df stringfromdate:time]; nsstring *filename = [nsstring stringwithformat:@"%@", timestring ]; //[time release]; // [df release]; // [timestring release]; return  filename ; } 

i using method every time generate filename whenever capture photo. variable local method. if try release time, df, timestring, after getting filename, getting message sent deallocated instance. sure if don't release these variables, memory leaking. tried instruments , got following result, , here is.
instruments leaks]![screensshot instruments showing memory leaks

now question meaning of red color highlighted row 79.6%? , 20.4% yellow color row highlighted? red in general dangerous. % shows? how getting calculated? , when check call tree, column named "leaks" perticular methods , contains 100, 234, 560, 2345, number. number speak about. me out. thankful if can provide me links understand instruments.

to explain percentages in screenshot, 79.6% of leaked memory allocated in getuniquefilename: allocated in red line of code. 20.4% of leaked memory allocated in getuniquefilename: allocated in yellow line of code. red indicates high percentage. may or may not dangerous.

to explain leaks column, tells number of leaks in method , functions method calls. not mean there many leaks in method itself. example, cocoa , cocoa touch apps start main() function. if main() function has value 100 in leaks column, means app has 100 memory leaks, not main() has 100 leaks.


Popular posts from this blog

node.js - How do I prevent MongoDB replica set from querying the primary? -

Apache NiFi ExecuteScript: Groovy script to replace Json values via a mapping file -

telerik - Reformat image format in PDF -