After a long profile test, I found that in one of my ".m" file memory leaks occurs in the viewdidload section. I checked and xcode highlighted the part in which I had initialized arrays of collectors with values. my program uses collectors for user input. and I have 3 5 different views in my program. the first is a disclaimer, the second is a menu in which the user can select the type of calculation that he / she wants to do. Each calculation requires a specific input that the user enters from the collector. eg. one of the types has 5 inputs, which are processed by 5 different uipickers with separate arrays for storing values. these arrays are initialized with values ββin the viewdidload method of this view. here is what i found after running the test:
.................................................. .................................................
This is my first app development, and I'm a little confused about what to do. Any help would be greatly appreciated.
Objects in object c have a save account. If this hold counter is greater than 0 when the object goes out of scope (when you stop using it), it flows.
The following things increase the number of deductions
, . ( - dealloc).
EDIT: ,
, , . , , , , , .
, :
-(init){ ... stagePickerArray = [[NSMutableArray alloc] init]; for (int i = 0; i < 3; i++) { //this string is autoreleased, you don't have call release on it. //methods with the format [CLASS CLASSwithsomething] tend to be autorelease NSString *s = [NSString stringWithFormat:@"%d", i); [stagePickerArray addObject:s]; } ... }
, , , - , dealloc.
-(void) dealloc { [stagepickerarray release]; //Do this for each of your arrays [super dealloc]; }
, yo , . , , ,
NSString* answer = [NSString stringWithFormat: ...
, . -stringWithFormat: , , , , . , .
-stringWithFormat:
, - , , , - . stagePickerArray. , stagePickerArray -. -viewDidLoad, . , -dealloc.
stagePickerArray
-viewDidLoad
-dealloc
Objective-C . β .
, , count = 1.
, , , . , 0, .
, - , . , , "" ( , ;)) release.
. iOS.
( - ARC - Automatic Retain Counting - iOS5! ios5