Memory Leak with NSFetchedResultsController objectAtIndex - iphone

I have a memory leak while using NSFetchedResultsController objectAtIndex:
The stack frame is as follow:
0 CoreFoundation __CFDataAllocate
1 CoreFoundation __CFDataInit
2 CoreData -[NSSQLCore _prepareResultsFromResultSet:usingFetchPlan:withMatchingRows:]
3 CoreData -[NSSQLCore _newRowsForFetchPlan:selectedBy:withArgument:]
4 CoreData -[NSSQLCore newRowsForFetchPlan:]
5 CoreData -[NSSQLCore objectsForFetchRequest:inContext:]
6 CoreData -[NSSQLCore executeRequest:withContext:error:]
7 CoreData -[NSPersistentStoreCoordinator executeRequest:withContext:error:]
8 CoreData -[NSManagedObjectContext executeFetchRequest:error:]
9 CoreData _faultBatchAtIndex
10 CoreData -[_PFBatchFaultingArray objectAtIndex:]
---> 11 MyApp -[DocumentViewController tableView:heightForRowAtIndexPath:]
12 UIKit -[UISectionRowData refreshWithSection:tableView:tableViewRowData:]
13 UIKit -[UITableViewRowData rectForFooterInSection:]
14 UIKit -[UITableViewRowData heightForTable]
15 UIKit -[UITableView(_UITableViewPrivate) _updateContentSize]
16 UIKit -[UITableView noteNumberOfRowsChanged]
17 UIKit -[UITableView reloadData]
18 UIKit -[UITableView layoutSubviews]
19 QuartzCore -[CALayer layoutSublayers]
20 QuartzCore CALayerLayoutIfNeeded
21 QuartzCore CA::Context::commit_transaction(CA::Transaction*)
22 QuartzCore CA::Transaction::commit()
23 QuartzCore CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
24 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
25 CoreFoundation __CFRunLoopDoObservers
26 CoreFoundation __CFRunLoopRun
27 CoreFoundation CFRunLoopRunSpecific
28 CoreFoundation CFRunLoopRunInMode
29 GraphicsServices GSEventRunModal
30 GraphicsServices GSEventRun
31 UIKit UIApplicationMain
From this stack frame, it looks like the object accessed with objectAtIndex get leaked.
However, when I leave the controller, its dealloc method get called. In this method, all the objects fetched by the fetchedresultscontroller are turned into fault since I use [NSManagedObjectContext refreshObject:mergeChange].
To be complete in my description, below is the code where the leaking object is created:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
Page* page = [[self fetchedResultsController] objectAtIndexPath:indexPath];
UIImage* thumbnail = [page getThumbnail];
[[self managedObjectContext] refreshObject:page.image mergeChanges:NO];
CGFloat height = [PageCell cellImageSize:thumbnail].height + 20;
return height;
}
Any hint would be appreciated,
Thanks!

Check the code where you get the UIImage. The leak is most likely there. Where it is exactly depends on how you create the image object.

Barring more evidence, that looks more like a leak in the bowels of Core Data. File a bug.

Related

SIGABRT received due to this code... Why?

I am trying to implement a tab bar controller, navigation controller and tableview into an application I'm working on but I am getting a SIGABRT error each time I try to run it and I don't know why and it is rather puzzling me. Below is the code that the console is referencing to (I believe):
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
// Set up the cell...
NSString *cellValue = [listOfCoffees objectAtIndex:indexPath.row];
cell.textLabel.text = cellValue;
return cell;
}
...and below is the console:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString tableView:cellForRowAtIndexPath:]: unrecognized selector sent to instance 0x6a17c00'
*** Call stack at first throw:
(
0 CoreFoundation 0x00dca5a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f1e313 objc_exception_throw + 44
2 CoreFoundation 0x00dcc0bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00d3b966 ___forwarding___ + 966
4 CoreFoundation 0x00d3b522 _CF_forwarding_prep_0 + 50
5 UIKit 0x00091b98 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 634
6 UIKit 0x000874cc -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:] + 75
7 UIKit 0x0009c8cc -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1561
8 UIKit 0x0009490c -[UITableView layoutSubviews] + 242
9 QuartzCore 0x016b4a5a -[CALayer layoutSublayers] + 181
10 QuartzCore 0x016b6ddc CALayerLayoutIfNeeded + 220
11 QuartzCore 0x0165c0b4 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
12 QuartzCore 0x0165d294 _ZN2CA11Transaction6commitEv + 292
13 QuartzCore 0x0165d46d _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 99
14 CoreFoundation 0x00dab89b __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 27
15 CoreFoundation 0x00d406e7 __CFRunLoopDoObservers + 295
16 CoreFoundation 0x00d091d7 __CFRunLoopRun + 1575
17 CoreFoundation 0x00d08840 CFRunLoopRunSpecific + 208
18 CoreFoundation 0x00d08761 CFRunLoopRunInMode + 97
19 GraphicsServices 0x010021c4 GSEventRunModal + 217
20 GraphicsServices 0x01002289 GSEventRun + 115
21 UIKit 0x0002ac93 UIApplicationMain + 1160
22 Affogato 0x00002259 main + 121
23 Affogato 0x000021d5 start + 53
24 ??? 0x00000001 0x0 + 1
)
terminate called throwing an exception
Any help would be greatly appreciated.
I'm quite sure the actual problem is somewhere else in the code, my guess would be you are using some string variable (possibly selectedCoffee ?) in place of the tableView's delegate.
The error is in the tableview delegate/datasource. CellForRowAtIndexPath is called by the tableview to query it's UITableViewCell object. Check your delegate/datasource connection.
Set a breakpoint and look where the app crash. Then we could help more.

TTSplitViewController with UITabBarController

I have a TTSplitViewController in which I am trying to show a UITabBarController at the left pane, via the code:
#implementation SplitAppController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
[self setupURLRouting];
}
return self;
}
- (void)setupURLRouting {
[self routePrimaryNavigator];
[self routeDetailsNavigator];
}
- (void)routePrimaryNavigator {
TTURLMap* map = self.primaryNavigator.URLMap;
// Forward all unhandled URL actions to the right navigator.
[map from: #"*" toObject: self selector: #selector(willOpenUrlPath:)];
[map from:#"tt://primary" toViewController:[RootViewController class]];
}
RootViewController here is a UITabBarController. However, I am getting the following error:
2011-07-08 08:04:23.739 app[3241:207] -[RootViewController topViewController]: unrecognized selector sent to instance 0x520c060
2011-07-08 08:04:23.755 app[3241:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RootViewController topViewController]: unrecognized selector sent to instance 0x520c060'
*** Call stack at first throw:
(
0 CoreFoundation 0x017d95a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0192d313 objc_exception_throw + 44
2 CoreFoundation 0x017db0bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x0174a966 ___forwarding___ + 966
4 CoreFoundation 0x0174a522 _CF_forwarding_prep_0 + 50
5 app 0x000f73ff -[TTSplitViewController updateSplitViewButton] + 176
6 app 0x000f75d9 -[TTSplitViewController viewDidAppear:] + 90
7 UIKit 0x00ae1fab -[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:] + 694
8 UIKit 0x00a64e4b -[UIView(Internal) _didMoveFromWindow:toWindow:] + 918
9 UIKit 0x00a63a60 -[UIView(Hierarchy) _postMovedFromSuperview:] + 166
10 UIKit 0x00a5c750 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1080
11 UIKit 0x00a5aaa3 -[UIView(Hierarchy) addSubview:] + 57
12 app 0x00083d01 -[TTBaseNavigator setRootViewController:] + 306
13 app 0x000841f9 -[TTBaseNavigator presentController:parentController:mode:action:] + 70
14 app 0x00084437 -[TTBaseNavigator presentController:parentURLPath:withPattern:action:] + 359
15 app 0x00084975 -[TTBaseNavigator openURLAction:] + 1320
16 app 0x0000c440 -[appAppDelegate application:didFinishLaunchingWithOptions:] + 848
17 UIKit 0x00a2bc89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
18 UIKit 0x00a2dd88 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439
19 UIKit 0x00a38617 -[UIApplication handleEvent:withNewEvent:] + 1533
20 UIKit 0x00a30abf -[UIApplication sendEvent:] + 71
21 UIKit 0x00a35f2e _UIApplicationHandleEvent + 7576
22 GraphicsServices 0x01fee992 PurpleEventCallback + 1550
23 CoreFoundation 0x017ba944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
24 CoreFoundation 0x0171acf7 __CFRunLoopDoSource1 + 215
25 CoreFoundation 0x01717f83 __CFRunLoopRun + 979
26 CoreFoundation 0x01717840 CFRunLoopRunSpecific + 208
27 CoreFoundation 0x01717761 CFRunLoopRunInMode + 97
28 UIKit 0x00a2d7d2 -[UIApplication _run] + 623
29 UIKit 0x00a39c93 UIApplicationMain + 1160
30 app 0x00031342 main + 130
31 app 0x00002a75 start + 53
)
terminate called after throwing an instance of 'NSException'
How do I fix this?
Seems like your code is expecting RootViewController to be a subclass of UINavigationController.
If you didn't write that code, you can make a UINavigationController subclass, and initialize it with your tab bar controller as a root view controller, and hide the navigation bar, I think this would give the results you are looking for.
EmilioPelaez is quite right, I just succeeded with a similar solution like this, and it works!
#implementation MainViewController
- (id)initWithNavigatorURL:(NSURL *)URL query:(NSDictionary *)query {
MainTabBarController *mainTabBarController = [[MainTabBarController alloc] init];
[mainTabBarController setTabURLs:[NSArray arrayWithObjects:
#"tt://firstLink",
#"tt://secondLink",
nil]];
self = [super initWithRootViewController:mainTabBarController];
[mainTabBarController release];
self.navigationBarHidden = YES;
return self;
}
#end
I found another way to make it work (and maybe the better way that reduce code complexity):
inherit UITabBarController with this additional method:
- (UIViewController *)topViewController {
return self;
}
It works perfectly.
is this right
[map from:#"tt://primary" toViewController:[RootViewController class]];
my suggestion is
[map from:#"tt://primary" toViewController:RootViewControllerobject];

Application Crashes on [scrollView removeFromSuperview];

Hell All,
I am new to iPhone and struggling with following problem.
When i remove scroll view with following statement my appli crashes.
[scrollView removeFromSuperview];
I am adding uiscrollview with following line.
[self.view addSubview:scrollView];
Hereis the log.
Thread 0 Crashed:
0 libobjc.A.dylib 0x34a80466 objc_msgSend + 18
1 UIKit 0x341aaaa8 -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 152
2 UIKit 0x341aaace -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 190
3 UIKit 0x341aaace -[UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 190
4 UIKit 0x341c05a0 -[UIView(Hierarchy) removeFromSuperview] + 208
5 UIKit 0x34249a76 -[UIScrollView removeFromSuperview] + 42
6 KabushikiShimbun 0x000387b6 -[PDFPageScrollViewController ReGenerateScrollViewAsperNewData] (PDFPageScrollViewController.m:1451)
7 KabushikiShimbun 0x00038aac -[PDFPageScrollViewController CheckPageUpdationWithDate:] (PDFPageScrollViewController.m:1441)
8 KabushikiShimbun 0x0003c472 -[PDFPageScrollViewController requestFinished:] (PDFPageScrollViewController.m:792)
9 CoreFoundation 0x35818bb8 -[NSObject(NSObject) performSelector:withObject:] + 16
10 KabushikiShimbun 0x0000e9ba -[ASIHTTPRequest reportFinished] (ASIHTTPRequest.m:1945)
11 CoreFoundation 0x35818bb8 -[NSObject(NSObject) performSelector:withObject:] + 16
12 Foundation 0x3118178e __NSThreadPerformPerform + 262
13 CoreFoundation 0x358307d6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6
14 CoreFoundation 0x358025b0 __CFRunLoopDoSources0 + 376
15 CoreFoundation 0x35801e54 __CFRunLoopRun + 224
16 CoreFoundation 0x35801c80 CFRunLoopRunSpecific + 224
17 CoreFoundation 0x35801b88 CFRunLoopRunInMode + 52
18 GraphicsServices 0x320c84a4 GSEventRunModal + 108
19 GraphicsServices 0x320c8550 GSEventRun + 56
20 UIKit 0x341dc322 -[UIApplication _run] + 406
21 UIKit 0x341d9e8c UIApplicationMain + 664
22 KabushikiShimbun 0x00002da6 main (main.m:14)
23 KabushikiShimbun 0x00002d70 start + 32
Any Idea ?
Thank you.
Check whether it has a superview before removing from superview;
if([scrollView superview]!=nil){
[scrollView removeFromSuperview];
}
Try this code
for(UIView *view in self.view.subviews)
{
if([view isMemberOfClass:[UIScrollView class]])
{
[scrollview removeFromSuperView];
}
}
Try this code. It's tested.
NSArray *subviews = [[NSArray alloc] initWithArray:self.view.subviews];
for(UIScrollView *subview in subviews) {
[subview removeFromSuperView];
}
[subviews release];
but be carefull it removes all ScrollViews present in your self.view

strange memory things in ios

IBOutlet UITextView *readme;
[super viewDidLoad];
NSString *string = [[NSString alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:#"README" ofType:#"txt"] encoding:NSUTF8StringEncoding error:nil];
readme.text = string;
This part of code makes EXC_BAD_ACCESS in UIApplicationMain when i change tab item to other. without this code everything working fine.
Any ideas?
NSZombieEnabled = YES, but point is leave on same position while i press next step.
IBOutlet is connected as reference outlet to readme. This is a stack.
0 libSystem.B.dylib calloc 1 libobjc.A.dylib NXHashInsert 2 libobjc.A.dylib
_NXHashRehashToCapacity 3 libobjc.A.dylib NXHashInsert 4 libobjc.A.dylib realizeClass(class_t*) 5 libobjc.A.dylib
_class_getNonMetaClass 6 libobjc.A.dylib _class_initialize 7 libobjc.A.dylib prepareForMethodLookup 8 libobjc.A.dylib lookUpMethod 9 libobjc.A.dylib
_class_lookupMethodAndLoadCache 10 libobjc.A.dylib objc_msgSend 11 UIKit -[UIWebDocumentView initSimpleHTMLDocumentWithStyle:editable:withFrame:withPreferences:] 12 UIKit -[UITextView commonInitWithWebDocumentView:isDecoding:] 13 UIKit -[UITextView initWithCoder:] 14 Foundation
_decodeObjectBinary 15 Foundation -[NSKeyedUnarchiver
_decodeArrayOfObjectsForKey:] 16 Foundation -[NSArray(NSArray) initWithCoder:] 17 Foundation
_decodeObjectBinary 18 Foundation _decodeObject 19 UIKit -[UIView initWithCoder:] 20 Foundation
_decodeObjectBinary 21 Foundation _decodeObject 22 UIKit -[UIRuntimeConnection initWithCoder:] 23 Foundation
_decodeObjectBinary 24 Foundation -[NSKeyedUnarchiver
_decodeArrayOfObjectsForKey:] 25 Foundation -[NSArray(NSArray) initWithCoder:] 26 Foundation
_decodeObjectBinary 27 Foundation _decodeObject 28 UIKit -[UINib instantiateWithOwner:options:] 29 UIKit
-[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] 30 UIKit -[UIViewController
_loadViewFromNibNamed:bundle:] 31 UIKit -[UIViewController loadView] 32 UIKit -[UIViewController view] 33 UIKit -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] 34 UIKit -[UITabBarController transitionFromViewController:toViewController:] 35 UIKit -[UITabBarController
_setSelectedViewController:] 36 UIKit -[UITabBarController
_tabBarItemClicked:] 37 UIKit -[UIApplication sendAction:to:from:forEvent:] 38 UIKit -[UITabBar
_sendAction:withEvent:] 39 UIKit -[UIApplication sendAction:to:from:forEvent:] 40 UIKit -[UIControl sendAction:to:forEvent:] 41 UIKit
-[UIControl(Internal) _sendActionsForEvents:withEvent:] 42 UIKit -[UIControl sendActionsForControlEvents:] 43 UIKit -[UIApplication sendAction:to:from:forEvent:] 44 UIKit -[UIControl sendAction:to:forEvent:] 45 UIKit
-[UIControl(Internal) _sendActionsForEvents:withEvent:] 46 UIKit -[UIControl touchesEnded:withEvent:] 47 UIKit
-[UIWindow _sendTouchesForEvent:] 48 UIKit -[UIApplication sendEvent:] 49 UIKit _UIApplicationHandleEvent 50 GraphicsServices PurpleEventCallback 51 CoreFoundation
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ 52 CoreFoundation
__CFRunLoopDoSource1 53 CoreFoundation __CFRunLoopRun 54 CoreFoundation CFRunLoopRunSpecific 55 CoreFoundation CFRunLoopRunInMode 56 GraphicsServices GSEventRunModal 57 GraphicsServices GSEventRun 58 UIKit UIApplicationMain 59 snow iphone main /Users/mac/Documents/Programming/Projects/snow
- head/snow iphone/main.m:13 60 snow iphone start
SOLUTION
UIImage *imageForEvents = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:#"events" ofType:#"png"]];
UITabBarItem *eventsBar = [[UITabBarItem alloc] initWithTitle:#"Events" image:imageForEvents tag:0];
events.tabBarItem = eventsBar;
[eventsBar release];
this peace of code was create in table view controller area. after i was change it to appdelegate, error was go out.
strange that debug don't show appropriate line of code.
Set NSZombieEnabled to check which object is responsible for EXC_BAD_ACCESS.
Are you sure readme IBOutlet is exactly connected in Interface Builder?
NSLog(#"className of readme is \"%#\".", [readme className]);
BTW, UITextView text property has copy attribute, autoreleased string would be nice.
NSString *string = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:#"README" ofType:#"txt"] encoding:NSUTF8StringEncoding error:nil];
The code you have posted should not cause EXC_BAD_ACCESS. Since EXC_BAD_ACCESS is what happens when you try to send a message to a class that has deallocated, I would look in your app for where you either release something and do not set the pointer to nil or if you should be retaining something and are not doing so.

NavigationController / TableView memory leak in Iphone

Recently I have finished my first Iphone app and it works grate.... except for when i did a intense session using instruments to find leaks after awhile with no leaks, all of a sudden get about 1.3Kb worth. In the stack trace they all point to the exact line that I release a UIViewControler on after pushing it to the Navigation controller (Ill post this code a bit further down). The Leak seem to happen after a few time navagating through the ViewControlers and back again. I know this is a very generally question but I hope someone could point me in the right direction. I have spent a few days trying to solve this and it is starting to dive me crazy!
My app is a Navigation based one, here is how it works in a nutshell:
Starts with a UIViewControler which when a button is pressed goes to another UIViewControler containing a TableView.
From here depending on the contents of the array that populates the TableView it could go to a UIViewControler containing a PickerView then to the last UIViewControler or just go straight to the last UIViewControler bypassing the one with the PickerView.
Here is the code that the stack trace says the Leak is on:
SoundConfiger *third = [[SoundConfiger alloc] initWithNibName:#"SoundConfiger" bundle:[NSBundle mainBundle]];
[third setTitle:#"Sound Link"];
third.myData = myData;
third.selectedRow = row;
third.currentChoise = nil;
[self.navigationController pushViewController:third animated:YES];
[third release]; <---- Instruments says the leak is here on this line.
Shouldn't the NavigationController be responsible for this UIViewcontroler now? I have not called retain on third anywhere else and it only exists in this function.
I have a Bunch of Leaks from UIkit and QuartsZone. I have a screen shot bellow of some of them, in the stack traces all point to the same snippet of code, in the same function, in the same object as stated above at some point in the trace:
Here is a Link to the image as I can't post images yet: Link no longer valid
Here is the compleat stack trace from the first GeneralBlock-16 in the list. The one in bold (line 29) is the code snippet above:
0 libSystem.B.dylib malloc
1 CoreFoundation -[__NSArrayM insertObject:atIndex:]
2 CoreFoundation -[__NSArrayM addObject:]
3 UIKit -[UIView(UIViewGestures) addGestureRecognizer:]
4 UIKit -[UISwitch _commonInit]
5 UIKit -[UISwitch initWithCoder:]
6 UIKit UINibDecoderDecodeObjectForValue
7 UIKit UINibDecoderDecodeObjectForValue
8 UIKit -[UINibDecoder decodeObjectForKey:]
9 UIKit -[UIView initWithCoder:]
10 UIKit UINibDecoderDecodeObjectForValue
11 UIKit -[UINibDecoder decodeObjectForKey:]
12 UIKit -[UIRuntimeConnection initWithCoder:]
13 UIKit UINibDecoderDecodeObjectForValue
14 UIKit UINibDecoderDecodeObjectForValue
15 UIKit -[UINibDecoder decodeObjectForKey:]
16 UIKit -[UINib instantiateWithOwner:options:]
17 UIKit -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:]
18 UIKit -[UIViewController _loadViewFromNibNamed:bundle:]
19 UIKit -[UIViewController loadView]
20 UIKit -[UIViewController view]
21 UIKit -[UIViewController contentScrollView]
22 UIKit -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:]
23 UIKit -[UINavigationController _layoutViewController:]
24 UIKit -[UINavigationController _startTransition:fromViewController:toViewController:]
25 UIKit -[UINavigationController _startDeferredTransitionIfNeeded]
26 UIKit -[UINavigationController pushViewController:transition:forceImmediate:]
27 UIKit 0x6ea9b5
28 UIKit -[UINavigationController pushViewController:animated:]
29 Booby Trap -[SelectEventTypeviewcontroler ChooseThisOne] /Users/chriswyllie/Documents/Booby Trap/Booby Trap/Classes/SelectEventTypeviewcontroler.m:91
30 CoreFoundation -[NSObject(NSObject) performSelector:withObject:withObject:]
31 UIKit -[UIApplication sendAction:to:from:forEvent:]
32 UIKit -[UIApplication sendAction:toTarget:fromSender:forEvent:]
33 UIKit -[UIControl sendAction:to:forEvent:]
34 UIKit -[UIControl(Internal) _sendActionsForEvents:withEvent:]
35 UIKit -[UIControl touchesEnded:withEvent:]
36 UIKit -[UIWindow _sendTouchesForEvent:]
37 UIKit -[UIWindow sendEvent:]
38 UIKit -[UIApplication sendEvent:]
39 UIKit _UIApplicationHandleEvent
40 GraphicsServices PurpleEventCallback
41 CoreFoundation CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION
42 CoreFoundation __CFRunLoopDoSource1
43 CoreFoundation __CFRunLoopRun
44 CoreFoundation CFRunLoopRunSpecific
45 CoreFoundation CFRunLoopRunInMode
46 GraphicsServices GSEventRunModal
47 GraphicsServices GSEventRun
48 UIKit -[UIApplication _run]
49 UIKit UIApplicationMain
50 Booby Trap main /Users/chriswyllie/Documents/Booby Trap/Booby Trap/main.m:14
51 Booby Trap start
Thanks for your help in advance, I am hope I am just doing something silly and I need a fresh set of eyes to see it. Let me know If you need more info.
Well I am a Tool :)
I was not handeling the IBOutlets correctly in each viewControler.
I was not declaring each IBOutlet using #property with a retain, using "self.someLabel = nil" (to release and set to the IBOutlets to nil) in the viewDidUnload method for a memory warning and then finally releasing in in dealloc.
thus tool. lol
What I was doing was declaring was "IBOutlet UILabel *someLabel;" in the header with no #property and this was causing the leaks seen above, they don't happen right away it takes a while and when they do the stack trace and every thing dose not help to much.
They only way I found what was leaking was striping everything out of my app and I mean everything until the leak went away.
Thanks for your help Ishu Gupta, I am glad we had a outcome.
Here are the relevant link to show how to do IBOutlets correctly: What happens if I don't retain IBOutlet?
SoundConfiger *third = [[[SoundConfiger alloc] initWithNibName:#"SoundConfiger" bundle:[NSBundle mainBundle]] autorelease];
and remove
[third release]; this line.
You can fix only those leaks which comes because of your code(forget release any object or some wrong things). But some time you get extra leaks these are present in iphone sdk. Actully some of functions or properties of iPhone having leaks.so these can be fixed only when you change the use of these.
And one thing more 1.3 KB leak is not bad if it will not be increase with app operations.