cenk ebret
cenk ebret

Reputation: 697

ModalViewController based app crashes after 30 presentations

I have an ipad App, which has categories (tableviewcontrollers inside it) and detail views which has a webview shows info of the row on tableview.

On didSelectRowAtIndexPath function of category table views i am using the code as:

DetayViewController *dvc = [[DetayViewController alloc] init];
Blog *b = (Blog *)[self.blogArray objectAtIndex:indexPath.row];
dvc.cagirilanBlog = b;
[self presentModalViewController:dvc animated:YES];

This works fine. But when using the app, if you click row in table view and open a detail page and close it for about 30 times, the application crashes and quit.

The warnings i get when the app crashes is like:

**Received memory warning. Level=1**

**Received memory warning. Level=2**

**Program received signal:  “0”.
Data Formatters temporarily unavailable, will re-try after a 'continue'. (Unknown error loading shared library "/Developer/usr/lib/libXcodeDebuggerSupport.dylib")**

When i dissmiss the modal view controller, i am releasing all the object i used on detail view. But the issue i can not solve is why is it crashing? is that a bug? Can not i use presentModalViewController more than 30 times?

Please help me.

Thanks.

Upvotes: 0

Views: 234

Answers (1)

William Remacle
William Remacle

Reputation: 1470

You need to release ressources that you have used (each memory allocations need to be released).

In your case :

[dvc release]

(If not, all objets you have released in dealloc method won't be called !)

You can also use the Leak performance tool provided with Xcode. (very useful for detecting memory leaks)

You should read this document : http://developer.apple.com/library/ios/#documentation/cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html

Upvotes: 3

Related Questions